3

There are several thread (like here or here) concerning the ways to convert a tweepy.Status object into json or dict.

Do you have a way to do the opposite? I've scrapped a bunch of tweets and stored them as dicts in a pickle file. Now I'm trying to load them and recreate the tweepy.Status object from this dict.

The reason I'm trying to do this is because I already have several functions that take a status as input and I'd rather not have to modify them all.

ysearka
  • 3,805
  • 5
  • 20
  • 41

1 Answers1

1

Tweepy.Status object is constructed through the classmethod tweepy.Status.parse(), which takes Tweepy's API object and a dictionary representing an API response JSON text.

So after you prepare an API object, you can construct Status object with a dictionary like this:

status = tweepy.Status.parse(api, tweet_dictionary)
shuuji3
  • 1,233
  • 13
  • 20