projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d967708
)
Handle Twitter API errors with successful HTTP status codes
author
Harmon
<Harmon758@gmail.com>
Sun, 4 Apr 2021 15:07:55 +0000
(10:07 -0500)
committer
Harmon
<Harmon758@gmail.com>
Sun, 4 Apr 2021 15:07:55 +0000
(10:07 -0500)
tweepy/parsers.py
patch
|
blob
|
blame
|
history
diff --git
a/tweepy/parsers.py
b/tweepy/parsers.py
index a0ca907383ee3e999997cacb28553da0e93f6245..916866c0a2a17e51ae829506401460e20275ac1d 100644
(file)
--- a/
tweepy/parsers.py
+++ b/
tweepy/parsers.py
@@
-73,10
+73,15
@@
class ModelParser(JSONParser):
else:
cursors = None
- if payload_list:
- result = model.parse_list(api, json)
- else:
- result = model.parse(api, json)
+ try:
+ if payload_list:
+ result = model.parse_list(api, json)
+ else:
+ result = model.parse(api, json)
+ except KeyError:
+ raise TweepyException(
+ f"Unable to parse response payload: {json}"
+ ) from None
if cursors:
return result, cursors