Open deg opened 1 month ago
Hi David,
I am having a similar issue, which is odd because I was able to successfully use my EPO OPS API keys with patent-client just a week or so ago, but today I am getting an "Inpadoc: Failed to authenticate with EPO OPS!" error.
One thing which appears incorrect in your code is that "PATENT_CLIENT_EPO_SECRET" should be "PATENT_CLIENT_EPO_API_SECRET"
I was (at least previously) able to successfully use my EPO OPS keys with patent-client using the below code: os.environ['PATENT_CLIENT_EPO_API_KEY'] = ##### os.environ['PATENT_CLIENT_EPO_API_SECRET'] = #####
So perhaps try changing the names of your environment variables and see if that works for you, but as I said I'm encountering a similar issue, despite being able to authenticate my EPO OPS keys on https://developers.epo.org/ (with their test API), so it's possible there is something else going on.
I was actually able to identify that the source of my particular error was coming from patent_client/_sync/epo/ops/session.py and in particular the build_refresh_request method of the OpsAuth class. I was able to fix my issue by reformatting the header of the request as follows:
def build_refresh_request(self): token = base64.b64encode(f"{self.key}:{self.secret}".encode()).decode('utf-8') headers = {"Authorization": f"Basic {token}"} return httpx.Request( "POST", self.auth_url, headers=headers, data={"grant_type": "client_credentials"} )
This is not my area of expertise, but unless I am missing something I don't believe the current patent-client library will be able to successfully authenticate EPO OPS credentials until this method is patched to have the correct header format.
I've moved past my earlier false alarm in #160 but now have a similar problem with the EPO API.
I do have the credentials set correctly, I think:
I've also successfully called the EPO API directly with code like
I assume this is my operator error again, but I don't see where.
Do I have the correct keys? developers.epo.org tells me that I have a "consumer key" and consumer secret key". Are these the same thing as the EPO OPS API keys that your API needs? Or do I need to get a different set?