Felipe's Blog

Your go-to source for Linux/Unix-like – tech – engineering.

Tweepy changes on Python

without comments

I was trying to use a parameter with the module tweepy, and I realised that the new version 4.0, has a change, well is very simple but it could create a whole new checking in your code, so it’s better to know already.

The change is, for ex. in the parameter ‘search’:

api = tweepy.API(auth)

for tweets in api.search(q="iphone", lang="en"):
    print(tweet.text)

Now, Tweepy v4.0.0 was released and renamed API.search to API.search_tweets.

I would recommend simply renaming your method call, but you could also downgrade to Tweepy v3.10.0.

It’s not nice, in my opinion to be changing all the time little parameters, but now it would be something like this:

for tweets in api.search_tweets(q="iphone", lang="en"):
    print(tweet.text)

Written by Felipe

April 26th, 2023 at 2:54 am

Posted in Python

Tagged with , ,