Jin-Dominique
Jin-Dominique

Reputation: 3243

How to gain authentication using tweepy

Q1: I am new to tweepy and I am trying to gain an authentication for twitter data by using tweedy

import tweedy
consumer_key='....'
consumer_secret='....'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret,'https://twitter.com')
token = session.get('request_token')
session.delete('request_token')
auth.set_request_token(token[0], token[1])

the python is throwing error because it doesn't recognize the commands session.get() and session.delete(). Am I doing this right? Can someone show me how to gain authentication using tweepy please?

Q2. I know that I can create an instance of tweepy by executing api = tweepy.API(auth) providing that I executed import twitter, would api.GetUser() still work?

I already consulted the tweepy documentation but it is confusing me even more...

Thank you

Upvotes: 0

Views: 706

Answers (1)

abarnert
abarnert

Reputation: 366073

If that's your actual code, you haven't defined anything named session anywhere, so presumably your error is something like this:

NameError: name 'session' is not defined

Since I have no idea what session is supposed to be in your code, it's hard to tell you how to fix it. Looking at the (presumably working) examples in the source tree, they don't seem to have anything similar to what you're trying to do.

Upvotes: 2

Related Questions