parkerhancock / patent_client

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

Problems with PublishedApplicationBiblio.objects.get on Ubuntu #130

Closed Shagrath9212 closed 9 months ago

Shagrath9212 commented 9 months ago

Hi! I have a very simpe code, which works fine on my Windows machine, but I can't execute on DigitalOcean Ubuntu droplet. By the way, other methods (such as Inpadoc.objects.get()) works fine. I also tried changing the version of Python, but that didn't work either. Here's the code from patent_client import PublishedApplication, Inpadoc, Patent, PublishedApplicationBiblio

if name == "main":
testFile=PublishedApplicationBiblio.objects.get('20180235467') print(testFile)

And here's the error (venv) root@ubuntu-s-1vcpu-1gb-fra1-01:/home/py2# python3 sample.py /home/py2/venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py:53: UserWarning: convert_to_json overrides an existing Pydantic @model_validator decorator warnings.warn(f'{k} overrides an existing Pydantic {existing.decorator_info.decorator_repr} decorator') Traceback (most recent call last): File "/home/py2/sample.py", line 4, in testFile=PublishedApplicationBiblio.objects.get('20180235467') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/patent_client/util/manager.py", line 159, in get return run_sync(self.aget(*args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/patent_client/util/asyncio_util.py", line 12, in run_sync return loop.run_until_complete(coroutine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/nest_asyncio.py", line 99, in run_until_complete return f.result() ^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/futures.py", line 203, in result raise self._exception.with_traceback(self._exception_tb) File "/usr/local/lib/python3.11/asyncio/tasks.py", line 277, in __step result = coro.send(None) ^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/patent_client/util/manager.py", line 151, in aget length = await mger.alen() ^^^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/patent_client/uspto/public_search/manager.py", line 55, in alen page = await public_search_api.run_query( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/patent_client/uspto/public_search/api.py", line 40, in run_query await self.get_session() File "/home/py2/venv/lib/python3.11/site-packages/patent_client/uspto/public_search/api.py", line 105, in get_session self.session = response.json() ^^^^^^^^^^^^^^^ File "/home/py2/venv/lib/python3.11/site-packages/httpx/_models.py", line 761, in json return jsonlib.loads(self.content, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ^CException ignored in: <module 'threading' from '/usr/local/lib/python3.11/threading.py'> Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1590, in _shutdown lock.acquire()

parkerhancock commented 9 months ago

Upstream USPTO error. You can't obtain a session to use the PublicSearch API.

I can't reproduce the error on my end. Retry and let me know if it works.