Skip to content

httpx.HTTPStatusError: Client error '403  #171

@amit-trexo

Description

@amit-trexo

I am getting the below exceptions regularly after fetching 115-120 applications in my django rest framework.
Initial investigation pointed to peds rate limiter, but on restart I am able to fetch another 120 set. So something is wrong in USApplication.objects.get(application_number).

Below is the error stack trace:

httpx.HTTPStatusError: Client error '403 Forbidden' for url 'https://ped.uspto.gov/api/queries'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
exiInternal Server Error: /api/patent-cli/17700494/
Traceback (most recent call last):
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/rest_framework/decorators.py", line 50, in handler
return func(*args, **kwargs)
File "/home/ubuntu/python/drf/api/views.py", line 21, in getData
app = USApplication.objects.get(application_number)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/patent_client/util/manager.py", line 180, in get
length = len(mger)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/patent_client/util/manager.py", line 165, in len
return self.count()
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/patent_client/_sync/uspto/peds/manager.py", line 59, in count
max_length = (api.create_query(**self.get_query_params())).num_found
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/patent_client/_sync/uspto/peds/api.py", line 118, in create_query
self.check_response(response)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/patent_client/_sync/uspto/peds/api.py", line 58, in check_response
raise e if alive else PedsDownException(reason)
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/patent_client/_sync/uspto/peds/api.py", line 55, in check_response
response.raise_for_status()
File "/home/ubuntu/python/venv/lib/python3.10/site-packages/httpx/_models.py", line 761, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions