I'm obviously making noob mistake here and requesting to point me in the right direction. I'm trying to download Transcripts using the below script
import PureCloudPlatformClientV2
from PureCloudPlatformClientV2.rest import ApiException
from pprint import pprint
import os
os.environ['GENESYS_CLOUD_CLIENT_ID'] = "client_id"
os.environ['GENESYS_CLOUD_CLIENT_SECRET'] = "client_secret"
region = PureCloudPlatformClientV2.PureCloudRegionHosts.eu_central_1
PureCloudPlatformClientV2.configuration.host = region.get_api_host()
apiclient = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token(os.environ['GENESYS_CLOUD_CLIENT_ID'], os.environ['GENESYS_CLOUD_CLIENT_SECRET'])
api_instance = PureCloudPlatformClientV2.SpeechTextAnalyticsApi()
conversation_id = 'conversation_id'
communication_id = 'communication_id'
try:
# Get the pre-signed S3 URL for the transcript of a specific communication of a conversation
api_response = api_instance.get_speechandtextanalytics_conversation_communication_transcripturl(
conversation_id, communication_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling GetSpeechandtextanalyticsConversationCommunicationTranscripturlRequest->get_speechandtextanalytics_conversation_communication_transcripturl: %s\n" % e)
It gives the below error.
Exception when calling GetSpeechandtextanalyticsConversationCommunicationTranscripturlRequest->get_speechandtextanalytics_conversation_communication_transcripturl: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '201', 'Connection': 'keep-alive', 'Date': 'Wed, 15 Mar 2023 11:45:04 GMT', 'ININ-Correlation-Id': '4916a5bc-b52a-4e8a-943c-9f1d949e7709', 'Strict-Transport-Security': 'max-age=600; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 57de08f1507f15361979f2f024f6cb40.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'HYD50-C2', 'X-Amz-Cf-Id': 'fCVKsYE5sZJKT4Y59AGZJrR9yJMms8kqEWN0iLxZ-SNOGeBLpHpiFQ=='})
HTTP response body: {"message":"No authentication bearer token specified in authorization header.","code":"authentication.required","status":401,"contextId":"4916a5bc-b52a-4e8a-943c-9f1d949e7709","details":[],"errors":[]}
I tried understanding how Auth works but couldn't figure out. Would appreciate any and all help.