(self, method, url_path, *args, **kwargs)
| 39 | self.rate_limit_reach = False |
| 40 | |
| 41 | def request(self, method, url_path, *args, **kwargs): |
| 42 | while self.rate_limit_reach: |
| 43 | sleep(1) |
| 44 | |
| 45 | url = urljoin(self.base_url, url_path) |
| 46 | r = super().request(method, url, verify=BookStack.VERIFY_SSL, *args, **kwargs) |
| 47 | |
| 48 | if r.status_code != 200: |
| 49 | if r.status_code == 429: |
| 50 | if not self.rate_limit_reach: |
| 51 | logger.info("API rate limit reach, waiting...") |
| 52 | self.rate_limit_reach = True |
| 53 | sleep(60) |
| 54 | self.rate_limit_reach = False |
| 55 | logger.info("Done waiting for the API rate limit") |
| 56 | return self.request(method, url, verify=BookStack.VERIFY_SSL, *args, **kwargs) |
| 57 | r.raise_for_status() |
| 58 | return r |
| 59 | |
| 60 | def get_list(self, url: str, count: int = 500, sort: str = None, filters: Dict = None): |
| 61 | # Add filter[...] to keys, avoiding the insertion of unwanted parameters |
nothing calls this directly
no outgoing calls
no test coverage detected