PureCloudPlatformClientV2 compatibility with Python 3.10.x

Has anyone able to get PureCloudPlatformClientV2 version 150.0.0 working on Python version 3.10 (Linux and Windows). Recently, I tried and unfortunately, I can’t get past authentication stage (TypeError: expected string or bytes-like object)! It feels like PureCloudPlatformClientV2 is not compatible with Python version 3.10. I am in the process testing it with Python 3.9.x but that’s bit involved on my side and that’s another story. Any pointes are be much appreciated.

Hi,

Can you share a copy of the code you are using? Redacting credentials of course.

I tried on OS X using python 3.10.6 and PureCloudPlatformClientV2 version 150.0.0 without issue.

Here's the code snippet.

import PureCloudPlatformClientV2
from PureCloudPlatformClientV2.rest import ApiException

Innovation Lab API Keys

client_id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
client_secret = 'xxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxx'
org_region = 'us_west_2'

try:
region = PureCloudPlatformClientV2.PureCloudRegionHosts[org_region]
PureCloudPlatformClientV2.configuration.host = region.get_api_host

apiclient = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token(client_id, client_secret)
authApi = PureCloudPlatformClientV2.AuthorizationApi(apiclient)

print(authApi.api_client.access_token)

except ApiException as e:
print(e)

This code appears incorrect, the second line in particular where you're assigning the function itself instead of invoking it. Refer to the example here: https://developer.genesys.cloud/devapps/sdk/docexplorer/purecloudpython/#setting-the-environment

Thanks Tim, I didn't realize till now my cut and paste did do the number on me!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.