Skip to content

Trouble following instructions to connect to API #35

@audrow

Description

@audrow

The README says that I can create an API client in the following way:

  # Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).

  pdf_api = asposepdfcloud.PdfApi('MY_CLIENT_ID', 'MY_CLIENT_SECRET')

  file_name = 'PdfWithAnnotations.pdf'
  page_number = 2
  response = pdf_api.get_page_annotations(file_name, page_number, folder=temp_folder)

but the PdfApi has the following init:

class PdfApi(object):
    def __init__(self, api_client=None):
        ...

I tried passing in the ApiClient then, but the ApiClient takes an app_key and app_sid, which I haven't been able to find on the Aspose website after registering and creating an application. I tried using my client ID and client secret for these arguments, respectively, but I get an invalid client error, so I suspect that I didn't create the client correctly.

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"}

Any suggestions on how to proceed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions