Skip to content

Error: Unauthorized: Access is denied due to invalid credentials, Code: 401 #682

@shsh88

Description

@shsh88

I'm getting this error:

ApiException: Error: Unauthorized: Access is denied due to invalid credentials, Code: 401 , X-global-transaction-id: 7ecac92c5d41bae959f499a9

when trying to run the following code which I followed from the example provided in personality_insights_v3.py :

service = PersonalityInsightsV3(
    version='2017-10-13',
    iam_apikey={'My_iam_apikey'},
    url='https://gateway-fra.watsonplatform.net/personality-insights/api'
)

with open('personality-v3.json') as profile_json:
    
    response = service.profile(
        profile_json.read(),
        accept='text/csv',
        csv_headers=True).get_result()

profile = response.content
cr = csv.reader(profile.splitlines())
my_list = list(cr)
for row in my_list:
    print(row)

python version

3.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions