Skip to content

Commit cf0fe1d

Browse files
authored
Merge pull request #352 from desecho/sentry-block
Add SentryBlockException
2 parents b6f58a9 + f21becf commit cf0fe1d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

InstagramAPI/InstagramAPI.py

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
# Issue 159, python3 import fix
3737
from .ImageUtils import getImageSize
3838

39+
from .exceptions import SentryBlockException
40+
3941

4042
class InstagramAPI:
4143
API_URL = 'https://i.instagram.com/api/v1/'
@@ -978,6 +980,10 @@ def SendRequest(self, endpoint, post=None, login=False):
978980
self.LastResponse = response
979981
self.LastJson = json.loads(response.text)
980982
print(self.LastJson)
983+
if 'error_type' in self.LastJson and self.LastJson['error_type'] == 'sentry_block':
984+
raise SentryBlockException(self.LastJson['message'])
985+
except SentryBlockException:
986+
raise
981987
except:
982988
pass
983989
return False

InstagramAPI/exceptions.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class SentryBlockException(Exception):
2+
pass

0 commit comments

Comments
 (0)