Pass a null value to tweepy.models.Status as sometimes database saved objects might not include it

This commit is contained in:
Manuel Cortez 2021-06-25 16:48:44 -05:00
parent c761230566
commit 77bee64421

View File

@ -15,7 +15,11 @@ def reduce_tweet(tweet):
entities[key] = tweet._json["entities"][key]
status_dict["entities"] = entities
# Quotes and retweets are different objects.
status = Status().parse(api=tweet._api, json=status_dict)
if hasattr(tweet, "_api"):
api = tweet._api
else:
api = None
status = Status().parse(api=api, json=status_dict)
if tweet._json.get("quoted_status"):
quoted_tweet = reduce_tweet(tweet.quoted_status)
# print(quoted_tweet)