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

Error while using example function #74

Closed
VolkovIlia opened this issue Nov 2, 2022 · 1 comment
Closed

Error while using example function #74

VolkovIlia opened this issue Nov 2, 2022 · 1 comment

Comments

@VolkovIlia
Copy link

Example:

from patent_client import Inpadoc, Assignment, USApplication, Patent
# Import the model classes you need
# Fetch US Patents with the word "tennis" in their title issued in 2010
pats = Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-12-31")
len(pats) > 10

Error:

Traceback (most recent call last):
  File "/home/volk/patents_search/test.py", line 5, in <module>
    len(pats) > 10
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/uspto/fulltext/manager.py", line 61, in __len__
    self.get_page(0)
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/uspto/fulltext/manager.py", line 153, in get_page
    results = self.parse_page(response_text)
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/uspto/fulltext/manager.py", line 169, in parse_page
    result = self.__schema__.load(tree)
  File "/home/volk/.local/lib/python3.10/site-packages/yankee/base/deserializer.py", line 106, in load
    return self.post_load(loaded_obj)
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/util/schema_mixin.py", line 27, in post_load
    return self.__model__(**obj)
TypeError: Patent.__init__() missing 1 required positional argument: 'publication_number'

Example:

pub = Inpadoc.objects.get('EP3082535A1')
print(pub.biblio.title)

Error:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 960, in json
    return complexjson.loads(self.content.decode(encoding), **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/volk/patents_search/test.py", line 24, in <module>
    pub = Inpadoc.objects.get('EP3082535A1')
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/epo/ops/published/manager.py", line 47, in get
    result = PublishedApi.biblio.get_biblio(number, doc_type, format)
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/epo/ops/published/api.py", line 47, in get_biblio
    return cls.get_constituents(number, doc_type, format, constituents="biblio")
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/epo/ops/published/api.py", line 40, in get_constituents
    response = session.get(url)
  File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/epo/ops/session.py", line 24, in request
    auth_response = self.get_token()
  File "/home/volk/.local/lib/python3.10/site-packages/patent_client/epo/ops/session.py", line 37, in get_token
    data = response.json()
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 968, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@parkerhancock
Copy link
Owner

For the Patents endpoint, the issue appears to be related to the deprecation of the PatFT/AppFT endpoints, currently being addressed in #63.

For the Inpadoc endpoint, I have opened a new issue #76 with a descriptive title while I investigate the issue.

Thanks!

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