mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 19:52: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/*.png
|
||||||
scripts/test*
|
scripts/test*
|
||||||
.vscode
|
.vscode
|
||||||
|
.idea
|
||||||
/tests/*.disabled
|
/tests/*.disabled
|
||||||
k8s/
|
k8s/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,8 @@ def public_ip(proxy: Optional[str] = None) -> str:
|
||||||
"https://ifconfig.co/ip",
|
"https://ifconfig.co/ip",
|
||||||
"https://ipecho.net/plain",
|
"https://ipecho.net/plain",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
exception = None
|
||||||
for url in URLS:
|
for url in URLS:
|
||||||
try:
|
try:
|
||||||
with _suppress_insecure_warning():
|
with _suppress_insecure_warning():
|
||||||
|
|
@ -113,8 +115,6 @@ def public_ip(proxy: Optional[str] = None) -> str:
|
||||||
ip = resp.text.strip()
|
ip = resp.text.strip()
|
||||||
validate_ip(ip)
|
validate_ip(ip)
|
||||||
return ip
|
return ip
|
||||||
except requests.exceptions.ProxyError as e:
|
except (requests.exceptions.ProxyError, requests.RequestException, InvalidIP) as exception:
|
||||||
raise InvalidProxy(f"Failed to connect to proxy: {proxy}") from e
|
|
||||||
except (requests.RequestException, InvalidIP):
|
|
||||||
pass
|
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