Skip to content

Instantly share code, notes, and snippets.

@sat0b
Created June 7, 2017 21:02
Show Gist options
  • Select an option

  • Save sat0b/bbf7de58337b094baf4cab15ad8eee7c to your computer and use it in GitHub Desktop.

Select an option

Save sat0b/bbf7de58337b094baf4cab15ad8eee7c to your computer and use it in GitHub Desktop.
import yaml
import twitter
def get_tweet():
with open("config.yaml") as f:
config = yaml.load(f)
stream = twitter.TwitterStream(auth=twitter.OAuth(
config["access_token"], config["access_token_secret"],
config["consumer_key"], config["consumer_secret_key"]),
secure=True)
tweets = stream.statuses.sample(language='ja')
for tweet in tweets:
print(tweet["text"])
if __name__ == '__main__':
get_tweet()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment