MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / get

Function get

etc/scripts/util/formatcheck.py:16–35  ·  view source on GitHub ↗
(entity: str, query: dict = None)

Source from the content-addressed store, hash-verified

14
15
16def get(entity: str, query: dict = None) -> dict:
17 if query is None:
18 query = {}
19 path = entity
20 if query:
21 querystring = urllib.parse.urlencode(query)
22 path += f"?{querystring}"
23 print(f"Getting {path}")
24 req = urllib.request.Request(
25 f"https://api.github.com/{path}",
26 None,
27 {
28 "User-Agent": USER_AGENT,
29 "Authorization": f"token {ACCESS_TOKEN}",
30 "Accept": "application/vnd.github.v3+json",
31 },
32 )
33 result = urllib.request.urlopen(req)
34 # It's ok not to check for error codes here. We'll throw either way
35 return json.loads(result.read())
36
37
38def paginated_get(entity: str, query: dict = None) -> [dict]:

Callers 1

paginated_getFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected