Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODP flow can't find key #160

Closed
deg opened this issue May 8, 2024 · 2 comments
Closed

ODP flow can't find key #160

deg opened this issue May 8, 2024 · 2 comments

Comments

@deg
Copy link

deg commented May 8, 2024

I'm trying to follow the instructions in https://patent-client.readthedocs.io/en/latest/user_guide/open_data_portal.html
It looks like there's a typo or a missing instruction (or I just misread something??)

$ PATENT_CLIENT_ODP_API_KEY=q__ELIDED__b

$ echo $PATENT_CLIENT_ODP_API_KEY
q__ELIDED__b

$ python
Python 3.12.1 (main, Feb 11 2024, 16:58:58) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
>>> from patent_client.odp import USApplicationBiblio
>>> app = USApplicationBiblio.objects.get("16123456")
Traceback (most recent call last):
    ...
    api = ODPApi()
          ^^^^^^^^
  File "/Users/deg/Documents/swirl/patent_search/.venv/lib/python3.12/site-packages/patent_client/_sync/uspto/odp/api.py", line 38, in __init__
    raise ValueError("ODP API key is not set")
ValueError: ODP API key is not set
>>>
@parkerhancock
Copy link
Owner

Huh. That should have worked.

Try this. Do the same thing, but after you get the error, type this in:

>>> import os
>>> os.environ["PATENT_CLIENT_ODP_API_KEY"]

and see if Python is seeing the set variable, and let me know. That will help me figure out if there's something wrong about how I am reading settings values (which uses pydantic-settings under the hood), or if there is something wrong with how Python is reading your environment.

Thanks for the bug report!

@deg
Copy link
Author

deg commented May 8, 2024

Never mind, it was my error.

I had done $ PATENT_CLIENT_ODP_API_KEY=... rather than $ export PATENT_CLIENT_ODP_API_KEY=...

Sorry for the false alarm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants