Using the Twitter API

Querying Twitter I

To interact with the Twitter API, we first need to create an instance of the Twitter package we imported earlier.

We can do this by calling the .Api() method on the twitter package and setting it equal to a variable, like twitter_api. The function also takes the four credentials you retrieved earlier as arguments, like so:

twitter_api = twitter.Api(consumer_key=twitter_consumer_key, consumer_secret=twitter_consumer_secret, access_token_key=twitter_access_token, access_token_secret=twitter_access_secret)
Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.