From d1ad07e21ebbd289db5c1311cb884598e6edd4a0 Mon Sep 17 00:00:00 2001 From: vs Date: Mon, 1 Jul 2024 19:12:55 +0300 Subject: [PATCH] add skip params --- outscraper/api_client.py | 8 +++++--- setup.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/outscraper/api_client.py b/outscraper/api_client.py index b6c7075..9daeaff 100644 --- a/outscraper/api_client.py +++ b/outscraper/api_client.py @@ -36,7 +36,7 @@ def get_tasks(self, query: str = '', last_id: str = '', page_size: int = 10) -> Parameters: query (str): parameter specifies the search query (tag). last_id (str): parameter specifies the last task ID. It's commonly used in pagination. - page_size (str): parameter specifies the number of items to return. + page_size (int): parameter specifies the number of items to return. Returns: list: requests history @@ -55,19 +55,21 @@ def get_tasks(self, query: str = '', last_id: str = '', page_size: int = 10) -> raise Exception(f'Response status code: {response.status_code}') - def get_requests_history(self, type: str = 'running') -> list: + def get_requests_history(self, type: str = 'running', skip: int = 0, page_size: int = 25) -> list: ''' Fetch up to 100 of your last requests. Parameters: type (str): parameter allows you to filter requests by type (running/finished). + skip (int): skip first N records. It's commonly used in pagination. + page_size (int): parameter specifies the number of items to return. Returns: list: requests history See: https://app.outscraper.com/api-docs#tag/Requests/paths/~1requests/get ''' - response = requests.get(f'{self._api_url}/requests?type={type}', headers=self._api_headers) + response = requests.get(f'{self._api_url}/requests?type={type}&skip={skip}&pageSize={page_size}', headers=self._api_headers) if 199 < response.status_code < 300: return response.json() diff --git a/setup.py b/setup.py index c4cb0ef..e902b0e 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def readme(): setup( name='outscraper', - version='5.2.0', + version='5.2.1', description='Python bindings for the Outscraper API', long_description=readme(), classifiers = ['Programming Language :: Python',