mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 13:02:04 -08:00
commit
c390b260b5
2 changed files with 5 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -17,6 +17,7 @@ pythonlib/*.png
|
|||
scripts/*.png
|
||||
scripts/test*
|
||||
.vscode
|
||||
.idea
|
||||
/tests/*.disabled
|
||||
k8s/
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ def public_ip(proxy: Optional[str] = None) -> str:
|
|||
"https://ifconfig.co/ip",
|
||||
"https://ipecho.net/plain",
|
||||
]
|
||||
|
||||
exception = None
|
||||
for url in URLS:
|
||||
try:
|
||||
with _suppress_insecure_warning():
|
||||
|
|
@ -113,8 +115,6 @@ 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):
|
||||
except (requests.exceptions.ProxyError, requests.RequestException, InvalidIP) as exception:
|
||||
pass
|
||||
raise InvalidIP("Failed to get IP address")
|
||||
raise InvalidIP(f"Failed to get IP address: {exception}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue