MCPcopy Create free account
hub / github.com/GerevAI/gerev / request

Method request

app/data_source/sources/bookstack/bookstack.py:41–58  ·  view source on GitHub ↗
(self, method, url_path, *args, **kwargs)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected