(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None, config={})
| 5516 | return results |
| 5517 | |
| 5518 | def fetch2(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None, config={}): |
| 5519 | if self.enableRateLimit: |
| 5520 | cost = self.calculate_rate_limiter_cost(api, method, path, params, config) |
| 5521 | self.throttle(cost) |
| 5522 | retries = None |
| 5523 | retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0) |
| 5524 | retryDelay = None |
| 5525 | retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0) |
| 5526 | for i in range(0, retries + 1): |
| 5527 | try: |
| 5528 | self.set_last_rest_request_timestamp() |
| 5529 | request = self.sign(path, api, method, params, headers, body) |
| 5530 | self.set_last_request(request) |
| 5531 | return self.fetch(request['url'], request['method'], request['headers'], request['body']) |
| 5532 | except Exception as e: |
| 5533 | if isinstance(e, OperationFailed): |
| 5534 | if i < retries: |
| 5535 | if self.verbose: |
| 5536 | index = i + 1 |
| 5537 | self.log('Request failed with the error: ' + str(e) + ', retrying ' + str(index) + ' of ' + str(retries) + '...') |
| 5538 | if (retryDelay is not None) and (retryDelay != 0): |
| 5539 | self.sleep(retryDelay) |
| 5540 | else: |
| 5541 | raise e |
| 5542 | else: |
| 5543 | raise e |
| 5544 | return None # self line is never reached, but exists for c# value return requirement |
| 5545 | |
| 5546 | def request(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None, config={}): |
| 5547 | return self.fetch2(path, api, method, params, headers, body, config) |
no test coverage detected