If you already have access credentials, skip this section.
- Go to https://apps.twitter.com/ and create a developer account.
- Click on the "Create New App" button, fill in the details and agree the Terms of Service.
- Navigate to "Keys and Access Tokens" section and take a note of your Consumer Key and Secret
- In the same section click on "Create my access token" button Take note of your Access Token and Access Token Secret
Add the aforementioned keys to a json file:
import json
credentials = {}
credentials['consumer_key'] = ...
credentials['consumer_secret''] = ...
credentials['access_key'] = ...
credentials['access_secret'] = ...
with open("twitter_credentials.json", "w") as file:
json.dump(credentials, file)
In terminal,
pip install nltk
pip install urlparse
pip install twython
In Python console,
import nltk
nltk.download('punkt')
nltk.download('stopwords')
Run twitter_reports.py.