From 97313aad4c694d0f5c263e963ddf912d784bd41b Mon Sep 17 00:00:00 2001 From: Geoffrey Pruvost Date: Thu, 12 Sep 2024 15:47:32 +0200 Subject: [PATCH] add page_number parameter to download all pages of pdf files --- patent_client/_sync/uspto/global_dossier/api.py | 4 ++-- patent_client/_sync/uspto/global_dossier/model.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patent_client/_sync/uspto/global_dossier/api.py b/patent_client/_sync/uspto/global_dossier/api.py index 352b8bb0..dac56ae9 100644 --- a/patent_client/_sync/uspto/global_dossier/api.py +++ b/patent_client/_sync/uspto/global_dossier/api.py @@ -54,6 +54,6 @@ def get_doc_list(self, country, doc_number, kind_code): response.raise_for_status() return DocumentList.model_validate_json(response.content) - def get_document(self, country, doc_number, document_id, out_path): - url = f"{self.get_base_url()}/doc-content/svc/doccontent/{country}/{doc_number}/{document_id}/1/PDF" + def get_document(self, country, doc_number, document_id, page_number, out_path): + url = f"{self.get_base_url()}/doc-content/svc/doccontent/{country}/{doc_number}/{document_id}/{page_number}/PDF" return client.download(url, path=out_path) diff --git a/patent_client/_sync/uspto/global_dossier/model.py b/patent_client/_sync/uspto/global_dossier/model.py index db9aa75b..c2c216c0 100644 --- a/patent_client/_sync/uspto/global_dossier/model.py +++ b/patent_client/_sync/uspto/global_dossier/model.py @@ -162,7 +162,7 @@ def download(self, filename="", path="."): else filename ) return global_dossier_api.get_document( - self.country, self.doc_number, self.doc_id, out_path=out_path + self.country, self.doc_number, self.doc_id, self.pages, out_path=out_path )