Skip to content

Commit

Permalink
add skip params
Browse files Browse the repository at this point in the history
  • Loading branch information
vs committed Jul 1, 2024
1 parent 5a5821a commit d1ad07e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions outscraper/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit d1ad07e

Please sign in to comment.