Next, we’ll make use of the watson_developer_cloud Python package we imported earlier.

Similar to how we interacted with the Twitter API, we’ll create an instance, initialize it with a username and password, and set it equal to a variable called personality_insights, like so:

personality_insights = PersonalityInsights(username=pi_username, password=pi_password)

The variable personality_insights represents the Personality Insights API that we’ll interact with.



In your application, somewhere after the PI credentials, initialize PersonalityInsights and pass in the pi_username and pi_password credentials as arguments.

Set it equal to a variable called personality_insights. Use the example above to help you.

Click Run to save your code.


Great! You’ve succesfully set up the Personality Insights API that we’ll interact with.

In the next unit, we’ll complete the Celebrity Match application by using PI to analyze the tweets and print out the results to the user.

We’ll also increase the quality of our code by making it easier to read and easier to use.

Click Up Next to move to the next unit.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?