LinuxBill
LinuxBill

Reputation: 415

Oauth Python twitter auth

import oauth2 as oauth

key = "xxxxx"
secret = "xxxxx"

request_token_url = "https://api.twitter.com/oauth/request_token"

consumer = oauth.Consumer(key= key, secret= secret)
client = oauth.Client(consumer)

resp, content = client.request(request_token_url, "GET")

print content

Once i have executed this script it works fine but what would be the best way to deal with the output it gives me.

The output is something like "xxxxxxxx&yyyyyyyyyy&zzzzzzzzz"

And i need to use the varaibles xxxx and yyyy how can i parse these and put them into variables?

Thanks William

Upvotes: 0

Views: 1038

Answers (1)

skndstry
skndstry

Reputation: 671

output = content.split('&')
x = output[0]
y = output[1]

also check out Tweepy for Python interaction with Twitter. https://github.com/tweepy/tweepy

Upvotes: 1

Related Questions