I’m currently working on a Python script in AWS Lambda that uses the Tweepy library to handle Twitter API requests. I’ve run into a persistent issue where my Lambda function fails to recognize the OAuthHandler from Tweepy. resulting in the following error:
AttributeError: module ‘tweepy’ has no attribute ‘OAuthHandler’
Here’s a snippet of how I’m trying to import and use OAuthHandler:
import tweepy
from tweepy import OAuthHandler
auth = OAuthHandler(TWITTER_API_KEY, TWITTER_API_SECRET_KEY)
I have confirmed that the Tweepy library is included in my deployment package and have tried using different versions of the library. Here are the specifics:
Python version: 3.9
Tweepy version: 4.14.0
Environment: AWS Lambda
Has anyone faced a similar issue, or can anyone suggest what might be going wrong here? Could it be related to the way Python packages are handled in AWS Lambda environments, or might there be an issue with the specific version of Tweepy I am using?
Any insights or suggestions would be greatly appreciated!
Thank you!
I already tried to modify the code and saw a reddit forum that tweepy no longer works because twitter put up a pay wall on it
also upgraded the tweepy to the latest version
Patrick Lacson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.