Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #28 from jmcs/handle-error-latest
Browse files Browse the repository at this point in the history
Handle error responses on get_latest_tag
  • Loading branch information
hjacobs committed Feb 5, 2016
2 parents 56ebbd8 + 7939c21 commit 8ae9cd3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pierone/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def docker_login_with_token(url, access_token):
json.dump(dockercfg, fd)


def request(url, path, access_token):
def request(url, path, access_token) -> requests.Response:
return session.get('{}{}'.format(url, path),
headers={'Authorization': 'Bearer {}'.format(access_token)}, timeout=10)

Expand Down Expand Up @@ -108,6 +108,7 @@ def get_latest_tag(token_name: str, image: DockerImage) -> bool:

try:
r = request(url, path, token['access_token'])
r.raise_for_status()
except:
return None
result = r.json()
Expand Down

0 comments on commit 8ae9cd3

Please sign in to comment.