parkerhancock / patent_client

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

Download patent as pdf #164

Closed prana2023 closed 2 months ago

prana2023 commented 2 months ago

I would like to download the patent as a PDF using patent IDs. I am using the following code but it is not working:

from patent_client import Patent

patent = Patent.objects.get("11478533") patent.download_images(path='/ub33/Downloads/')

Do I need an API key to access ppubs uspto ?

See the error stack I get:

File "/Users/ub33/PycharmProjects/tpp/dataprocessing/Patent.py", line 4, in patent.download_images(path='/ub33/Downloads/') File "/Users/ub33/PycharmProjects/tpp/venv/lib/python3.9/site-packages/patent_client/_sync/uspto/public_search/model/document.py", line 205, in download_images return public_search_api.download_image(self, path) File "/Users/ub33/PycharmProjects/tpp/venv/lib/python3.9/site-packages/patent_client/_sync/uspto/public_search/api.py", line 173, in download_image response.raise_for_status() File "/Users/ub33/PycharmProjects/tpp/venv/lib/python3.9/site-packages/httpx/_models.py", line 761, in raise_for_status raise HTTPStatusError(message, request=request, response=self) httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://ppubs.uspto.gov/dirsearch-public/print/print-process' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

david-lightbringer commented 2 months ago

FYI: I cannot repeat this error, it works well for me. Maybe it was an upstream error at USPTO (maintenance or whatever)?

Do you still have the issue?

parkerhancock commented 2 months ago

For the record, this API is pretty flakey. It isn't an API per-se, since I'm automating the Patents Public Search interface for it, and it changes frequently without notice, and has some backend instability. If it is throwing a 404 error, it's probably a USPTO issue. If you consistently have the issue and it seems like it's a patent_client library, I'm happy to take a deeper look!