Created
June 7, 2017 21:02
-
-
Save sat0b/bbf7de58337b094baf4cab15ad8eee7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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