Skip to content

Commit

Permalink
* Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
itsankoff committed Nov 3, 2023
1 parent 07c59fc commit 28f641a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ logs:

clean: stop
@docker rm $(CONTAINER_NAME) || true


6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_media(self, pages=sys.maxsize, per_page=30):
if resp.status_code != 200:
err = self.parse_error(resp)
print("failed to get media for page {}: {}. try renewing the auth token".format(current_page, err))
return False
return []

content = resp.json()
output_media += content["_embedded"]["media"]
Expand Down Expand Up @@ -154,6 +154,10 @@ def main():
return -1

media = gpp.get_media(pages=args.pages, per_page=args.per_page)
if not media:
print('failed to get media')
return -1

filenames = gpp.get_filenames_from_media(media)
print("listing media: {}".format(filenames))

Expand Down

0 comments on commit 28f641a

Please sign in to comment.