DEV Community

Pavan Gole
Pavan Gole

Posted on


How to get data in json format from tweepy.Client() ?

Top comments (1)

nestedsoftware profile image
Nested Software • Edited

When you get your tweepy.Client object, you can specify your desired return type:

The default is Response but you can ask for dict instead, e.g. set return_type=dict when you make your call to tweepy.Client. This will cause your subsequent calls to return a standard python 3 dictionary. You should then be able to convert that dictionary to json using python's json.dumps:

Another option is to convert the Response object to a dict:

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.