Skip to content

Commit f21becf

Browse files
committed
Add SentryBlockException
1 parent b7c8d9c commit f21becf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

InstagramAPI/InstagramAPI.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
# Issue 159, python3 import fix
3636
from .ImageUtils import getImageSize
3737

38+
from .exceptions import SentryBlockException
39+
3840

3941
class InstagramAPI:
4042
API_URL = 'https://i.instagram.com/api/v1/'
@@ -875,6 +877,10 @@ def SendRequest(self, endpoint, post=None, login=False):
875877
self.LastResponse = response
876878
self.LastJson = json.loads(response.text)
877879
print(self.LastJson)
880+
if 'error_type' in self.LastJson and self.LastJson['error_type'] == 'sentry_block':
881+
raise SentryBlockException(self.LastJson['message'])
882+
except SentryBlockException:
883+
raise
878884
except:
879885
pass
880886
return False

InstagramAPI/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class SentryBlockException(Exception):
2+
pass

0 commit comments

Comments
 (0)