First off, according to the README.md on Github:
# Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
pdf_api_client = asposepdfcloud.ApiClient('MY_CLIENT_ID', 'MY_CLIENT_SECRET')
pdf_api = asposepdfcloud.PdfApi(pdf_api_client)
file_name = 'PdfWithAnnotations.pdf'
page_number = 2
response = pdf_api.get_page_annotations(file_name, page_number, folder=temp_folder)
This example, which is crucial to start using the Python REST API doesn’t work, it’ll simply give you an error.
asposepdfcloud.rest.ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Sat, 20 Mar 2021 22:05:00 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': 'AWSALB=GEPeXFXylmkX26v1qIjS7hP9twmsQm6aYh0INhQ4x8rCSmtPTfdUILgfMq+QPyqQlXgznQ9VvLp1f/LcBCUlXncp1UYUY8G/C4uXNCjCnFlgmKh3mcbz4QvrSTJI; Expires=Sat, 27 Mar 2021 22:05:00 GMT; Path=/, AWSALBCORS=GEPeXFXylmkX26v1qIjS7hP9twmsQm6aYh0INhQ4x8rCSmtPTfdUILgfMq+QPyqQlXgznQ9VvLp1f/LcBCUlXncp1UYUY8G/C4uXNCjCnFlgmKh3mcbz4QvrSTJI; Expires=Sat, 27 Mar 2021 22:05:00 GMT; Path=/; SameSite=None; Secure, .Prj.Customer=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax, .Prj.Customer=1c681fac-b5ae-4078-bede-29c25d3578dc; expires=Sun, 20 Mar 2022 22:05:00 GMT; path=/; samesite=lax; httponly', 'Cache-Control': 'no-store, no-cache, max-age=0', 'Pragma': 'no-cache'})
HTTP response body: {"error":"invalid_client"}
Now, the issue is that Aspose made a mistake, whereby it’s reading the client_id as client_secret, and opposite. The quick workaround is to just swap the variables around.
This was brought to their attention on Mar 20, 2021, it’s now more than 3 years later and it’s still not fixed.
- EDIT: Everything below this line was caused by user error and is NOT an issue!
Then you continue, now you want to do a simple operation like replacing some text.
Then you get this error:
asposepdfcloud.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 30 May 2024 17:13:35 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive'})
HTTP response body: {"RequestId":"a519229f001f8c7502f46b66558e9886","Error":{"Code":"errorAmazonS3Storage","Message":"AmazonS3 Storage exception: The specified key does not exist. Bucket 'aspose.cloud-filestorage-prod', FilePath '1000164/ada7fd05-e1cb-41d0-aef2-19102f2a1c65/*redacted*.pdf'","Description":"Operation Failed. The remote server returned an error: (404) Not Found.","DateTime":"2024-05-30T17:13:35.0063916Z","InnerError":null}}
Using their own tests, we get this error. Why include tests if they are never ran/evaluated?
What is going on? Can someone make the damn SDK usable?