Answered
Getting Exception trying an Example
I'm getting the below exception while trying this python snippet.
ERROR:root:Exception encountered while executing operation
Traceback (most recent call last):
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/auth/service_principal_authenticator.py", line 68, in refresh_token
response = http_client.process_request(http_request=http_request, success_status_codes=[HTTPStatus.OK],
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/http_client.py", line 38, in process_request
if _handle_response_and_retry(response, success_status_codes,
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/http_client.py", line 95, in _handle_response_and_retry
should_retry = ResponseUtil.handle_api_failures(response, request_key, is_ims_api)
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/response_util.py", line 76, in handle_api_failures
return ResponseUtil.handle_cpf_error_response(response)
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/response_util.py", line 141, in handle_cpf_error_response
raise OperationException(message="Error response received for request",
adobe.pdfservices.operation.internal.exceptions.OperationException
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/ipykernel_85606/324766877.py", line 38, in <cell line: 9>
result: FileRef = extract_pdf_operation.execute(execution_context)
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/pdfops/extract_pdf_operation.py", line 153, in execute
raise ex
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/pdfops/extract_pdf_operation.py", line 141, in execute
download_uri = ExtractPDFService.extract_pdf(execution_context, self._source_file_ref, self.get_options(),
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/service/extract_pdf_service.py", line 44, in extract_pdf
raise e
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/service/extract_pdf_service.py", line 29, in extract_pdf
get_upload_uri_response = StorageApi.get_upload_uri(context, source_file_ref.get_media_type(), x_request_id)
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/api/storage_api.py", line 72, in get_upload_uri
response = http_client.process_request(http_request=http_request,
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/http_client.py", line 31, in process_request
access_token = http_request.authenticator.session_token().access_token
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/auth/service_principal_authenticator.py", line 49, in session_token
return self.refresh_token()
File "/home/rajesh/Documents/random/funenv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/auth/service_principal_authenticator.py", line 74, in refresh_token
raise SdkException("Exception in fetching access token", sys.exc_info())
adobe.pdfservices.operation.exception.exceptions.SdkException: description =Exception in fetching access token, requestTrackingId=(<class 'adobe.pdfservices.operation.internal.exceptions.OperationException'>, OperationException(), <traceback object at 0x7f7e54508c80>)
I have already setup env var for PDF_SERVICES_CLIENT_ID and PDF_SERVICES_CLIENT_SECRET.
Can someone please help?
