Performs a single API request
(off: int, lim: int)
| 112 | raise exceptions.BadRequest("limit parameter must be >= 0") |
| 113 | |
| 114 | def fetch(off: int, lim: int): |
| 115 | """ |
| 116 | Performs a single API request |
| 117 | """ |
| 118 | resp = requests.get( |
| 119 | f"{url}?limit={lim}&offset={off}{add_params}", headers=_headers, cookies=cookies, timeout=10 |
| 120 | ).json() |
| 121 | |
| 122 | if not resp: |
| 123 | return None |
| 124 | if resp == {"code": "BadRequest", "message": ""}: |
| 125 | raise exceptions.BadRequest("The passed arguments are invalid") |
| 126 | return resp |
| 127 | |
| 128 | api_data = api_iterative_data( |
| 129 | fetch, limit, offset, max_req_limit=max_req_limit, unpack=True |