0
import oauth2 as auth

consumer = auth.Consumer(key=consumer_key, secret=consumer_secret)
access_token = auth.Token(key=access_token, secret=access_token_secret)
client = oauth.Client(consumer, access_token)

endpoint = "https://stream.twitter.com/1.1/statuses/sample.json"

response, data = client.request(endpoint)

tweets = json.loads(data)
for tweet in tweets:
  print (tweet)

The code above is supposed to get sample tweets from Twitter through REST API but anytime I run the code nothing shows. Using the same code I was able to get my Twitter timeline. Could anyone help as I do not know what I am doing wrong?

ranaz
  • 97
  • 1
  • 10

0 Answers0