You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is pretty simple - the PublicSearchAPI or (or rather public_search_api in patent_client/_async/uspto/public_search/manager.py) needs a new session because the old authentication token has a timeout of 1800 seconds. The timeout seems to reset after each use, so continuous use of the same session works as long as no two request are separated by more than 1800 seconds.
As a workaround for others with the same issue until this is updated you can do something like:
import patent_client
import time
doc1 = patent_client.PublicSearchDocument.objects.get('6103599')
time.sleep(2000)
from patent_client._sync.uspto.public_search.manager import public_search_api
public_search_api.get_session()
doc2 = patent_client.PublicSearchDocument.objects.get('9421317')
Where the session is force-updated before the second search.
The text was updated successfully, but these errors were encountered:
Example code that crashes:
The result is
Client error '401 Unauthorized' for url 'https://ppubs.uspto.gov/dirsearch-public/searches/counts'
The reason is pretty simple - the
PublicSearchAPI
or (or ratherpublic_search_api
inpatent_client/_async/uspto/public_search/manager.py
) needs a new session because the old authentication token has a timeout of 1800 seconds. The timeout seems to reset after each use, so continuous use of the same session works as long as no two request are separated by more than 1800 seconds.As a workaround for others with the same issue until this is updated you can do something like:
Where the session is force-updated before the second search.
The text was updated successfully, but these errors were encountered: