def verify_oauth(access_token,access_token_secret):
# consumer key and secret. these keys are generated when creating
# our twitter app on the twitter developer portal. They are needed
# when verifing twitter credentials
consumer_key='kbwf3Qbb6MfjXiPirco5j3UYe'
consumer_secret='1Lr0HOTxQBLU22FsH2CH9RFBtnQCHwjAsidZrctvYoy9yIDX7n'
# url of twitter api that verifys a users credentials
url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
# oAuth1 method that creates an authorization object to hand to
# twitters api
auth = OAuth1(consumer_key, consumer_secret, access_token, access_token_secret)
# gets request from twitter api
# returns json result from request
return requests.get(url, auth=auth)
# main method
verify_oauth.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录