本文整理汇总了Python中tweepy.OAuthHandler.access_token方法的典型用法代码示例。如果您正苦于以下问题:Python OAuthHandler.access_token方法的具体用法?Python OAuthHandler.access_token怎么用?Python OAuthHandler.access_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tweepy.OAuthHandler
的用法示例。
在下文中一共展示了OAuthHandler.access_token方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: authorizeAndShowFriends
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import access_token [as 别名]
def authorizeAndShowFriends(request):
auth = OAuthHandler(ckey,csecret)
callback_url = 'http://127.0.0.1:8000/test'
auth = tweepy.OAuthHandler(ckey, csecret, callback_url)
if not request.GET.get('oauth_token'):
return HttpResponseRedirect(auth.get_authorization_url())
request.session['request_token'] = request.GET.get('oauth_token')
print "auth.request_token:",request.GET.get('oauth_token')
#auth.set_access_token(atoken,asecret)
auth.access_token = request.session.get('request_token')
api = tweepy.API(auth)
friends = api.friends()
print "Friends:",friends
return HttpResponse(friends)
示例2: OAuthHandler
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import access_token [as 别名]
#!/usr/bin/env python2.7
#! -*- coding:utf-8 -*-
from tweepy.streaming import StreamListener
from tweepy import API, OAuthHandler, Stream
import commands
import platform
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = OAuthHandler(consumer_key, consumer_secret)
auth.access_token = access_token
auth.access_token_secret = access_token_secret
auth.apply_auth()
api = API(auth)
class Commands(StreamListener):
def post_on_twitter(self, data):
for i in range(0, int(len(data) / 140) + 1):
if i == 0:
first = 140 * i
last = 140 - (140 * i)
else:
first = (140 * (i + 1)) - 140
last = 140 * (i + 1)
status = data[first:last]
if status:
api.update_status(status=status)