Tweepy API Request to twitter return me Twitter error response: status code=401.
This is my actual code:
def func():
tweets = list(tweepy.Cursor(
api.search, "{0}".format("COVID-19"), lang="en",tweet_mode='extended', count=5).items(7))
Tweet_outpt = []
for i in tweets:
text = i.full_text
place = ""
if i.place:
place = i.place.full_name
json_output = {
"tweet": text,
}
Tweet_outpt.append(json_output)
return Tweet_outpt
final_arr=func()
df = pd.DataFrame(final_arr)
df
TweepError Traceback (most recent call last)
<ipython-input-2-f192d2ae6519> in <module>
13 Tweet_outpt.append(json_output)
14 return Tweet_outpt
---> 15 final_arr=func()
16 df = pd.DataFrame(final_arr)
17 df
5 frames
/usr/local/lib/python3.7/dist-packages/tweepy/binder.py in execute(self)
232 raise RateLimitError(error_msg, resp)
233 else:
--> 234 raise TweepError(error_msg, resp, api_code=api_error_code)
235
236 # Parse the response payload
TweepError: Twitter error response: status code = 401
I have been tried to scrap the tweets using tweepy package got all the required keys. Is tweepy package will not work? Could anyone help me resolve this issue.