Skip to content

Commit

Permalink
fix: _latest_version and sentry dns internet checks (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-dixit authored Jan 28, 2025
1 parent 9e52124 commit 723b713
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
12 changes: 8 additions & 4 deletions python/composio/utils/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ def update_dsn() -> None:
if data.get("sentry", {}).get("dsn") is not None:
return

dsn = fetch_dsn()
if dsn is None:
return
try:
dsn = fetch_dsn()
if dsn is None:
return

data["sentry"] = {"dsn": dsn}
except Exception: # pylint: disable=broad-except
pass

data["sentry"] = {"dsn": dsn}
user_file.parent.mkdir(parents=True, exist_ok=True)
user_file.write_text(json.dumps(data), encoding="utf-8")
15 changes: 9 additions & 6 deletions python/composio/utils/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@

def _fetch_latest_version():
global _latest_version
request = requests.get(COMPOSIO_PYPI_METADATA, timeout=10.0)
if request.status_code != 200:
return

data = request.json()
_latest_version = data["info"]["version"]
try:
request = requests.get(COMPOSIO_PYPI_METADATA, timeout=10.0)
if request.status_code != 200:
return

data = request.json()
_latest_version = data["info"]["version"]
except Exception: # pylint: disable=broad-except
pass


def create_latest_version_warning_hook(version: str):
Expand Down

0 comments on commit 723b713

Please sign in to comment.