本文整理汇总了Python中tweepy.OAuthHandler.secure方法的典型用法代码示例。如果您正苦于以下问题:Python OAuthHandler.secure方法的具体用法?Python OAuthHandler.secure怎么用?Python OAuthHandler.secure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tweepy.OAuthHandler
的用法示例。
在下文中一共展示了OAuthHandler.secure方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def __init__(self, twitter_auth_params):
'''
Constructor
'''
auth = OAuthHandler(twitter_auth_params.getConsumerKey(), twitter_auth_params.getConsumerSecret())
auth.secure = True
auth.set_access_token(twitter_auth_params.getAccessTokenKey(), twitter_auth_params.getAccessTokenSecret())
self.__twitterApi = API(auth)
示例2: start_twitter
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def start_twitter():
global api
global auth
auth = OAuthHandler(config['CONSUMER_TOKEN'], config['CONSUMER_SECRET'])
auth.secure = True
auth.set_access_token(config['ACCESS_TOKEN'],
config['ACCESS_TOKEN_SECRET'])
api = API(auth)
示例3: init_api
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def init_api(self):
oauth_handler = TweepyOAuthHandler(
self._consumer_key,
self._consumer_secret)
oauth_handler.secure = configuration.twitter['use_https']
oauth_handler.set_access_token(self._access_token_key,
self._access_token_secret)
self._api = BaseTweepyApi(oauth_handler)
示例4: main
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def main():
try:
auth = OAuthHandler(consumer_key, consumer_secret)
auth.secure = True
auth.set_access_token(access_token, access_token_secret)
api = API(auth)
print(api.me().name)
stream = Stream(auth, StdOutListener())
stream.userstream()
except BaseException as e:
print("Error in main()", e)
示例5: main
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def main():
global api
try:
auth = OAuthHandler(CONSUMER_TOKEN, CONSUMER_SECRET)
auth.secure = True
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = API(auth)
stream = Stream(auth, StdOutListener())
stream.userstream()
except BaseException as e:
print("Error in main()", e)
示例6: main
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def main():
try:
auth = OAuthHandler(consumer_key, consumer_secret)
auth.secure = True
auth.set_access_token(access_token_key, access_token_secret)
api = API(auth)
# If the authentication was successful, you should
# see the name of the account print out
print(api.me().name)
stream = Stream(auth, Listener())
stream.userstream()
except BaseException as e:
print("Error in main()", e)
示例7: main
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
def main():
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# create a file handler
handler = logging.FileHandler('goddit.log')
handler.setLevel(logging.INFO)
# create a logging format
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
# add the handlers to the logger
logger.addHandler(handler)
try:
auth = OAuthHandler(consumer_key, consumer_secret)
auth.secure = True
auth.set_access_token(access_token, access_token_secret)
api = API(auth)
# If the authentication was successful, you should
# see the name of the account print out
#print(api.me().name)
stream = Stream(auth, tweetchazzer(api=api, logger=logger))
s = stream.userstream()
#while True:
# s = stream.filter(track=['tweetchazzer'])
#print(str(s))
except BaseException as e:
print("Error in main()" +str(e))
示例8: ConfigParser
# 需要导入模块: from tweepy import OAuthHandler [as 别名]
# 或者: from tweepy.OAuthHandler import secure [as 别名]
from py2neo import Graph
from neo4j import tweet_to_neo4j
#implement config parser to avoid showing secrets on github
config = ConfigParser()
config.read('config.ini')
consumer_key = config.get("twitter", "consumer_key")
consumer_secret = config.get("twitter", "consumer_secret")
access_token_key = config.get("twitter", "access_token_key")
access_token_secret = config.get("twitter", "access_token_secret")
#authoize th twitter stream
auth = OAuthHandler(consumer_key, consumer_secret)
auth.secure = True
auth.set_access_token(access_token_key, access_token_secret)
#neo4j graph
graph = Graph("http://neo4j:[email protected]:7474/db/data/")
class TwitterListener(StreamListener):
""" A Handlers which sends tweets received by the string to the current RDD
"""
def __init__(self):
self.hashtag_bucket = []
# def on_connect(self):
# self.start_time = time.time()
# time.sleep(1)