Hello, I am working on Tweepy and I need to collect tweets for just specific dates, not the recent ones as Tweepy does. I tried using the “start_time” and “end_time” features but it showed as “Unexpected parameter: start_time”.The “start_time” and “end_time” features work in Postman API but not in Python code. So, can anyone help me with the problem!!
Hi @nshashank_02 ,
What kind of endpoint are you using?
Or, what kind of function are you using in tweepy?
Well, I am getting some results. I did use the endpoint “https://api.twitter.com/2/tweets/search/all” and I’m getting the results. But, without using any endpoint is it possible? Because I’m getting tweets without the start date and end date input using Tweepy. But, if I want to have tweets from a specific date, I want to use them. So, any suggestions regarding that? I’ll share the screenshot of the code without using the endpoint.
I have never used tweepy, but looking at the latest tweepy implementation, it seems that the following methods support the /2/tweets/search/all endpoint and the /2/tweets/search/recent endpoint.
https://github.com/tweepy/tweepy/blob/e2fb467b52659e87de592ff80b03edb9324c0189/tweepy/client.py#L1173
And I guess search_tweets you’re using is for v1.1 endpoint.
So is it possible to use search_all_tweetsl or search_recent_tweets instead? Then you can use start_time and end_time 
1 Like
The main issues are: You need Academic Access to search for tweets with a specific date that’s not the last 7 days. If you did not apply for Academic Access separately to your developer account and do not have a separate Project on your dashboard, you do not have academic access Twitter Developer Access - twarc
Also you are using v1.1 APIs, not v2. Academic access is for v2 only. Tweepy does support this, but using tweepy.Client Client — tweepy 4.12.1 documentation only - tweepy.API API — tweepy 4.12.1 documentation is for v1.1 Only.
Your code also expects v1.1 Format tweets, which may not work in v2.
Twarc can be used here too, maybe with fewer code changes than for tweepy if you want to try that too: Examples of using twarc2 as a library - twarc
1 Like