Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn
Using the Twitter API

Authenticating with Twitter

Now that we have the basic setup in our file, it's time to start retrieving some data from Twitter.

Before we can interact with the Twitter API, we need to authenticate with the Twitter API. To do this, make sure you have your Twitter credentials handy:

  1. Start by navigating to https://apps.twitter.com (make sure you are logged in to Twitter, or create an account first)
  2. Click on "Create New App"
  3. Fill out the "Application Details"
  4. Navigate to the "Keys and Access Tokens" tab
  5. Take note of your Consumer Key (API Key) and Consumer Secret (API Secret)
  6. Click on "Create my access token" under "Token Actions" at the bottom of the page
  7. Take note of your Access Token and Access Token Secret

Once you have the credentials, add them to the correct variables in the following lines of code:

twitter_consumer_key = '' twitter_consumer_secret = '' twitter_access_token = '' twitter_access_secret = ''

These credentials will allow us to call the Twitter API using the Twitter package we imported earlier.

Instructions

Add your Twitter credentials to CelebrityMatch.py. Make sure you add them to the correct variables.

twitter_consumer_key = '' twitter_consumer_secret = '' twitter_access_token = '' twitter_access_secret = ''

Note: Remember, without Twitter credentials, your Watson-powered application will not work. If you don't have a Twitter account, first create one and then retrieve your credentials.

Click Run to save your code, then click Next to continue.

Report a Bug
If you see a bug or any other issue with this page, please report it here.