MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / fetch

Function fetch

scratchattach/utils/commons.py:114–126  ·  view source on GitHub ↗

Performs a single API request

(off: int, lim: int)

Source from the content-addressed store, hash-verified

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

Callers 1

fetchDataFunction · 0.85

Calls 2

jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected