projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4590c7a
)
Default to User model in Status.parse more broadly for user attribute
author
Harmon
<Harmon758@gmail.com>
Thu, 28 Jan 2021 19:54:30 +0000
(13:54 -0600)
committer
Harmon
<Harmon758@gmail.com>
Thu, 28 Jan 2021 19:54:30 +0000
(13:54 -0600)
To handle parsers without model_factory attribute or model factories without user attribute
tweepy/models.py
patch
|
blob
|
blame
|
history
diff --git
a/tweepy/models.py
b/tweepy/models.py
index 9a2447b4dc0c2ce6588c52ed173396aaf8b230fc..fc776d700b94c95f28a6a97983c4aa4054a60e4f 100644
(file)
--- a/
tweepy/models.py
+++ b/
tweepy/models.py
@@
-92,8
+92,10
@@
class Status(Model, Hashable):
setattr(status, '_json', json)
for k, v in json.items():
if k == 'user':
- user_model = getattr(api.parser.model_factory, 'user') if api else User
- user = user_model.parse(api, v)
+ try:
+ user = api.parser.model_factory.user.parse(api, v)
+ except AttributeError:
+ user = User.parse(api, v)
setattr(status, 'author', user)
setattr(status, 'user', user) # DEPRECIATED
elif k == 'created_at':