def get_access_creds():
'''
Twitter API authentication credentials are stored in a file as:
consumer_key \t consumer_secret \t access_token \t access_secret
'''
oauths = []
print('Building list of developer access credentials...')
credentials = pd.read_csv('twitter_dev_accounts', sep='\t', header=None, names=['consumer_key', 'consumer_secret', 'access_token', 'access_secret'])
for index, row in credentials.iterrows():
auth = tweepy.auth.OAuthHandler(str(row['consumer_key']), str(row['consumer_secret']))
auth.set_access_token(str(row['access_token']), str(row['access_secret']))
oauth_api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
if(verify_working_credentials(oauth_api)):
oauths.append(oauth_api)
return oauths
oauth_handler.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录