mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 16:12:05 -08:00
pythonlib: Error handling for invalid addon paths & proxies 0.3.3
Help prevent confusion with using Camoufox addons #55
This commit is contained in:
parent
732d7bac8d
commit
f94452fa93
3 changed files with 7 additions and 2 deletions
|
|
@ -54,6 +54,10 @@ def confirm_paths(paths: List[str]) -> None:
|
|||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
raise InvalidAddonPath(path)
|
||||
if not os.path.exists(os.path.join(path, 'manifest.json')):
|
||||
raise InvalidAddonPath(
|
||||
'manifest.json is missing. Addon path must be a path to an extracted addon.'
|
||||
)
|
||||
|
||||
|
||||
def get_open_port() -> int:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from functools import lru_cache
|
|||
from typing import Dict, Optional, Tuple
|
||||
|
||||
import requests
|
||||
from urllib3 import disable_warnings
|
||||
from urllib3.exceptions import InsecureRequestWarning
|
||||
|
||||
from .exceptions import InvalidIP, InvalidProxy
|
||||
|
|
@ -108,6 +107,8 @@ def public_ip(proxy: Optional[str] = None) -> str:
|
|||
ip = resp.text.strip()
|
||||
validate_ip(ip)
|
||||
return ip
|
||||
except requests.exceptions.ProxyError as e:
|
||||
raise InvalidProxy(f"Failed to connect to proxy: {proxy}") from e
|
||||
except (requests.RequestException, InvalidIP):
|
||||
pass
|
||||
raise InvalidIP("Failed to get IP address")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|||
|
||||
[tool.poetry]
|
||||
name = "camoufox"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
description = "Wrapper around Playwright to help launch Camoufox"
|
||||
authors = ["daijro <daijro.dev@gmail.com>"]
|
||||
license = "MIT"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue