Skip to content

Commit

Permalink
Fix intermittent launch error due to IP connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Dec 14, 2024
1 parent 6127dde commit 31b9671
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jarvis/executors/internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ def public_ip_info() -> Dict[str, str]:
dict:
Public IP information.
"""
# todo: Identify usage and try to use looping and try several hosts
try:
return json.load(urllib.request.urlopen(url="https://ipinfo.io/json"))
except (urllib.error.HTTPError, urllib.error.URLError) as error:
return json.load(urllib.request.urlopen(url="https://ipinfo.io/json", timeout=3))
except Exception as error:
logger.error(error)
try:
return json.loads(urllib.request.urlopen(url="http://ip.jsontest.com").read())
except (urllib.error.HTTPError, urllib.error.URLError) as error:
return json.loads(urllib.request.urlopen(url="http://ip.jsontest.com", timeout=3).read())
except Exception as error:
logger.error(error)


Expand Down

0 comments on commit 31b9671

Please sign in to comment.