pip install rauth
python
CONSUMER_KEY = 'your_consumer_key'
CONSUMER_SECRET = 'your_consumer_secret'
ACCESS_TOKEN = 'your_access_token'
ACCESS_TOKEN_SECRET = 'your_access_token_secret'
python
import rauth
import json
python
twitter = rauth.OAuth1Service(
consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
access_token=ACCESS_TOKEN,
access_token_secret=ACCESS_TOKEN_SECRET
)
python
oauth1_session = twitter.get_session(token=(ACCESS_TOKEN, ACCESS_TOKEN_SECRET))
python
response = oauth1_session.get('https://api.twitter.com/1.1/statuses/home_timeline.json')
python
data = response.json()
python
import rauth
import json
CONSUMER_KEY = 'your_consumer_key'
CONSUMER_SECRET = 'your_consumer_secret'
ACCESS_TOKEN = 'your_access_token'
ACCESS_TOKEN_SECRET = 'your_access_token_secret'
twitter = rauth.OAuth1Service(
consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
access_token=ACCESS_TOKEN,
access_token_secret=ACCESS_TOKEN_SECRET
)
oauth1_session = twitter.get_session(token=(ACCESS_TOKEN, ACCESS_TOKEN_SECRET))
response = oauth1_session.get('https://api.twitter.com/1.1/statuses/home_timeline.json')
data = response.json()
for tweet in data:
print(tweet['text'])