attributeerror: api object has no attribute search
In this blog post, we will learn about how we can solve this attributeerror: api object has no attribute search error.
What is tweepy?
If you’re like me, you probably spend way too much time on Twitter. And if you’re like me, you’re probably also interested in ways to automate as much of that time as possible. Lucky for us, there’s tweepy! Tweepy is a python module that helps you access the Twitter API. It makes it easy to retrieve data from Twitter and post updates to Twitter.
How we can fix the attributeerror: api object has no attribute search
The most updated version of Tweepy (versions above 4) now has a search_tweets
method instead of a search
method. Also, check the documentation.
You can use search_tweets method like this
API.search_tweets(q, *, geocode, lang, locale, result_type, count, until, since_id, max_id, include_entities)
Also, keep in mind that the search API has only a limit of 7 days of the history of tweets.
Also, read Python Tutorials.