2013-03-27 82 views
0
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 

一旦我已经执行了这个脚本,它能正常工作,但是最好的方式是处理它给我的输出。Oauth Python twitter auth

的输出是一样的东西“XXXXXXXX & YYYYYYYYYY &泣鬼神”

,我需要我如何分析这些使用varaibles XXXX和YYYY并付诸变量?

感谢 威廉

回答

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

还检查了Tweepy与Twitter的Python的互动。 https://github.com/tweepy/tweepy

+0

非常感谢。只是学习! – LinuxBill 2013-03-27 15:38:58

+0

另一个选项是[rauth](https://github.com/litl/rauth)看到这个[Twitter示例](https://github.com/litl/rauth/blob/master/examples/twitter-timeline-cli的.py)。 – maxcountryman 2013-03-28 23:13:57