nltk.twitter.util module¶
Authentication utilities to accompany twitterclient.
- class nltk.twitter.util.Authenticate[source]¶
Bases:
object
Methods for authenticating with Twitter.
- load_creds(creds_file=None, subdir=None, verbose=False)[source]¶
Read OAuth credentials from a text file.
File format for OAuth 1:
app_key=YOUR_APP_KEY app_secret=YOUR_APP_SECRET oauth_token=OAUTH_TOKEN oauth_token_secret=OAUTH_TOKEN_SECRET
File format for OAuth 2:
app_key=YOUR_APP_KEY app_secret=YOUR_APP_SECRET access_token=ACCESS_TOKEN
- Parameters
file_name (str) – File containing credentials.
None
(default) reads data from TWITTER/’credentials.txt’
- nltk.twitter.util.add_access_token(creds_file=None)[source]¶
For OAuth 2, retrieve an access token for an app and append it to a credentials file.