pip install rauth python import rauth import requests import json python consumer_key = 'YOUR_CONSUMER_KEY' consumer_secret = 'YOUR_CONSUMER_SECRET' access_token = 'YOUR_ACCESS_TOKEN' access_token_secret = 'YOUR_ACCESS_TOKEN_SECRET' python def get_user_timeline(): session = rauth.OAuth1Session( consumer_key=consumer_key, consumer_secret=consumer_secret, access_token=access_token, access_token_secret=access_token_secret) response = session.get( 'https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=YOUR_SCREEN_NAME&count=10') if response.status_code == 200: tweets = json.loads(response.text) for tweet in tweets: print(tweet['text']) else:


上一篇:
下一篇:
切换中文