Path: blob/master/april_18/lessons/lesson-14/code/twitter-instructions.md
1904 views
Instructions for capturing tweets
Setting up Twitter API credentials
Sign In, and then follow the instructions below:
Press "Create New App"
Fill in form (you can enter your website or any website in the 'website' field i.e. http://google.com)
Press 'Create application'
Press 'Manage keys ...'
Press 'Create access tokens'
Find and save four values
Consumer Key
Consumer Secret
Access Token Key
Access Token Secret
Running the code
Install TwitterAPI:
pip install TwitterAPI
Substitute the four values saved from 'Setting up Twitter API credentials' in
twitter.py
in
Run
python capture-tweets.py <topic>
to save tweets to file calledcaptured-tweets.txt
related to<topic>
. I.e.:python capture-tweets.py Google
orpython capture-tweets.py Iran