Skip to content

Commit

Permalink
Merge pull request #352 from desecho/sentry-block
Browse files Browse the repository at this point in the history
Add SentryBlockException
  • Loading branch information
LevPasha authored Mar 26, 2018
2 parents b6f58a9 + f21becf commit cf0fe1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions InstagramAPI/InstagramAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# Issue 159, python3 import fix
from .ImageUtils import getImageSize

from .exceptions import SentryBlockException


class InstagramAPI:
API_URL = 'https://i.instagram.com/api/v1/'
Expand Down Expand Up @@ -978,6 +980,10 @@ def SendRequest(self, endpoint, post=None, login=False):
self.LastResponse = response
self.LastJson = json.loads(response.text)
print(self.LastJson)
if 'error_type' in self.LastJson and self.LastJson['error_type'] == 'sentry_block':
raise SentryBlockException(self.LastJson['message'])
except SentryBlockException:
raise
except:
pass
return False
Expand Down
2 changes: 2 additions & 0 deletions InstagramAPI/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class SentryBlockException(Exception):
pass

0 comments on commit cf0fe1d

Please sign in to comment.