I am new to django framework. I tried to create a login authentication through twitter using tweepy. While saving the fetched data in my db, I am facing this issue for OAuth1Session. I have tweepy installed. I have also installed requests_oauthlib, but still doesn't able to resolve this error.
from tweepy.auth import OAuthHandler #error called here (**ImportError: cannot import name 'OAuth1Session' from 'requests_oauthlib'** )
from .models import Tweet
import credentials
def user_tweets():
auth = OAuthHandler(credentials.CONSUMER_KEY, credentials.CONSUMER_SECRET)
auth.set_access_token(credentials.ACCESS_TOKEN, credentials.ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
user_tweets = api.user_timeline(count=50)
return user_tweets
Make sure you've installed
requests
as well. So, for example, you can do this:or