I am on a developer account where for the last year I have been developing a bot. Originally I used v1.1 to make tweets and now with v2 I have updated my code to make tweets successfully.
Now I am try to do searches using search_recent_tweets
. The full search I have read is restricted to Academic access which I don't have for my bot. But I should be able to get search_recent_tweets
to return results?
When I use client.search_recent_tweets
from python code with tweepy, I get a 401 Unauthorized Error and I wonder why since my credentials work for making tweets. My search code is:
from config_v2 import create_client
# Create Client object
client = create_client()
query = 'point_radius:[25.11 -82.054 1km]'
dict_object = client.search_recent_tweets(query=query, max_results = 10, start_time='2022-12-06T05:00:00Z')
with open('geo_test.txt', 'w') as f:
for k in dict_object.keys():
f.write(k + '\t' + dict_object[k] + '\n')
My authentication code:
client = tweepy.Client(
consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
access_token=ACCESS_TOKEN,
access_token_secret=ACCESS_TOKEN_SECRET
)