Skip to content

Commit

Permalink
Handle unexpected HTTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocj89 committed Mar 2, 2024
1 parent e8a5d5b commit 99148ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eas/api/instagram/lamadava.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import contextlib
import datetime as dt
import functools
import logging
Expand Down Expand Up @@ -37,7 +38,8 @@ def fetch_comments(media_pk): # pragma: no cover
)
if not response.ok:
LOG.warning("Failed lamadava request! %s", response.text)
if response.json()["exc_type"] == "NotFoundError":
return []
with contextlib.suppress(Exception):
if response.json()["exc_type"] == "NotFoundError":
return []
response.raise_for_status()
return response.json()

0 comments on commit 99148ad

Please sign in to comment.