Skip to content
Advertisement

Tweepy does not return includes object using StreamingClient

I am using tweepy 4.10.1 to fetch Tweets using StreamingClient, but I am unable to load any media info or even includes object itself. I have tried the similar code using get_tweet() method and media and includes were received fine.

The code:

JavaScript

I am receiving following error:

JavaScript

When I use the same tweet id with get_tweet() method, I can retrieve media from includes fine.

JavaScript

According to Google, official docs and FAQ, I have tried all recommended steps I found

What am I missing here?

Advertisement

Answer

EDIT

I have discovered that using on_data() is the proper way how to retrieve all data from tweet. It covers all tweet, includes and other objects.

So the proper code should looks like this:

JavaScript

Deprecated solution

The TweetPrinter class should contain function to handle when includes received like this:

JavaScript

Thanks to this article, it helped me to find the proper solution :)

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement