Skip to content

Commit

Permalink
Merge pull request #1904 from nicomiguelino/fix-dockerhub-exception-h…
Browse files Browse the repository at this point in the history
…andling

Adds exception handling when making an API call to Docker Hub
  • Loading branch information
nicomiguelino authored May 23, 2024
2 parents fac3153 + 4543685 commit 5d009ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ def get_latest_docker_hub_hash(device_type):
"""

url = 'https://hub.docker.com/v2/namespaces/screenly/repositories/anthias-server/tags'
response = requests_get(url)

try:
response = requests_get(url)
response.raise_for_status()
except exceptions.RequestException as exc:
logging.debug('Failed to fetch latest Docker Hub tags: %s', exc)
return None

data = response.json()
results = data['results']

Expand Down

0 comments on commit 5d009ed

Please sign in to comment.