Learn
Using the Personality Insights API
Using the Personality Insights Package

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.

Instructions

1.

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.

2.

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.

Folder Icon

Take this course for free

Already have an account?