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

GlobalDossier exception on objects.get #140

Closed
KennethThompson opened this issue Jan 12, 2024 · 1 comment
Closed

GlobalDossier exception on objects.get #140

KennethThompson opened this issue Jan 12, 2024 · 1 comment

Comments

@KennethThompson
Copy link
Contributor

When executing the following code:

def test_oa_():
    error_log = []
    try:
        #from patent_client import GlobalDossierApplication
        app = GlobalDossierApplication.objects.get("17002555", type="application", office="US")
        found = False
        for oa in app.office_actions:
            print('ok!')
    except Exception as ex:
        just_the_string = traceback.format_exc()
        reason = f'[OAParserAgent] ERROR: {str(ex)}, Details = {just_the_string}.'
        print( reason)
        #return False, reason, error_log

This application number is triggering an exception:

CLIENT: Server listening on port 38989...
Received JSON data in run script
Running pytest with args: ['-p', 'vscode_pytest', '--rootdir', '/workspaces', '--capture', 'no', '/workspaces/tests/test_base.py::test_oa_']
============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.4, pluggy-1.3.0
rootdir: /workspaces
configfile: pyproject.toml
plugins: anyio-4.2.0, asyncio-0.23.3
asyncio: mode=Mode.STRICT

----------------------------- live log collection ------------------------------
INFO     patent_client:__init__.py:46 Starting Patent Client with log level INFO
INFO     patent_client.epo.ops.legal.national_codes:national_codes.py:31 Legal Code Database is Current - skipping database creation
INFO     patent_client:__init__.py:76 Startup Complete!, took 12.825 seconds
INFO     pikepdf._core:__init__.py:13 pikepdf C++ to Python logger bridge initialized
collected 1 item

tests/test_base.py::test_oa_
-------------------------------- live log call ---------------------------------
INFO     httpx:_client.py:1729 HTTP Request: OPTIONS https://gd-api2.uspto.gov/patent-family/svc/family/application/US/17002555 "HTTP/2 204 No Content"
INFO     httpx:_client.py:1729 HTTP Request: GET https://gd-api2.uspto.gov/patent-family/svc/family/application/US/17002555 "HTTP/2 200 OK"
[OAParserAgent] ERROR: 2 validation errors for GlobalDossier
list.0.priorityClaimList
  Input should be a valid array [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/list_type
list.0.pubList
  Input should be a valid array [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/list_type, Details = Traceback (most recent call last):
  File "/workspaces/tests/test_base.py", line 298, in test_oa_
    app = GlobalDossierApplication.objects.get("17002555", type="application", office="US")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/patent_client/util/manager.py", line 159, in get
    return run_sync(self.aget(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/patent_client/util/asyncio_util.py", line 12, in run_sync
    return loop.run_until_complete(coroutine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/nest_asyncio.py", line 99, in run_until_complete
    return f.result()
           ^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/futures.py", line 203, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 314, in __step_run_and_handle_result
    result = coro.send(None)
             ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/patent_client/uspto/global_dossier/manager.py", line 32, in aget
    gd_file = await global_dossier_api.get_file(**query)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/patent_client/uspto/global_dossier/api.py", line 12, in get_file
    return GlobalDossier.model_validate_json(response.content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 532, in model_validate_json
    return cls.__pydantic_validator__.validate_json(json_data, strict=strict, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for GlobalDossier
list.0.priorityClaimList
  Input should be a valid array [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/list_type
list.0.pubList
  Input should be a valid array [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/list_type

@parkerhancock parkerhancock mentioned this issue May 2, 2024
@parkerhancock
Copy link
Owner

Resolved in v5.0.1! Try

pip install --upgrade patent_client

Let me know if you're still having issues!

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