parkerhancock / patent_client

A collection of ORM-style clients to public patent data
Other
83 stars 33 forks source link

Failed to authenticate with EPO OPS! Please check your credentials. #132

Closed echoopen closed 8 months ago

echoopen commented 8 months ago

Sorry, but I would like you to help me check if there is something wrong with my code.thanks

import os os.environ['PATENT_CLIENT_EPO_API_KEY'] = "qhhhJEomwIu8uH9b5O7AaqPfwNlEnVik" os.environ['PATENT_CLIENT_EPO_SECRET'] = "OXIu6zrsbg4iBOl6" print(os.environ['PATENT_CLIENT_EPO_API_KEY']) print(os.environ['PATENT_CLIENT_EPO_SECRET']) from patent_client import Inpadoc case = Inpadoc.objects.get("EP1000000A1")

The error is: image

However, when I test using the official website’s api, 200 OK is returned. image

parkerhancock commented 8 months ago

[!CAUTION] PLEASE DELETE AND REFRESH YOUR API KEY! You just publicly posted your API key, which means it should be considered compromised.

Also, the error here is that the secret is "PATENT_CLIENT_EPO _API _SECRET". Closing to minimize visibility. I may also add an error if no key is detected.

echoopen commented 8 months ago

thank you

amit-trexo commented 8 months ago

I did it like below: os.environ['PATENT_CLIENT_EPO_API_KEY'] = os.environ['PATENT_CLIENT_EPO_API_SECRET'] =

still it says: patent_client.epo.ops.session.OpsAuthenticationError: Failed to authenticate with EPO OPS! Please check your credentials. See the setup instructions at https://patent-client.readthedocs.io/en/stable/getting_started.html

i was able to play around in epo-ops using the same credentials. Please help !

parkerhancock commented 8 months ago

@amit-trexo your issue is that the OPS client is initialized when patent_client is imported. Make sure your os calls are made before you import patent_client and it should work. Also look into using python-dotenv, which is my preferred way of doing this.

amit-trexo commented 8 months ago

Thanks for such a prompt response. It worked for me.