2024-01-21 17:45:01 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2025-01-09 19:22:28 +03:00
|
|
|
from functools import cache
|
|
|
|
|
from pathlib import Path
|
2024-01-21 17:45:01 +00:00
|
|
|
from urllib.parse import urlparse
|
|
|
|
|
|
2025-01-09 19:22:28 +03:00
|
|
|
is_docker = cache(Path("/.dockerenv").exists)
|
2024-02-01 07:24:26 +00:00
|
|
|
|
2024-01-21 17:45:01 +00:00
|
|
|
|
2024-04-11 22:57:18 +03:00
|
|
|
def is_http_url(value: str, /) -> bool:
|
2024-01-21 17:45:01 +00:00
|
|
|
parsed_url = urlparse(value)
|
2024-04-11 22:57:18 +03:00
|
|
|
return bool(parsed_url.scheme in {"http", "https"} and parsed_url.netloc)
|