MCPcopy
hub / github.com/mxrch/GHunt / _load_endpoint

Method _load_endpoint

ghunt/objects/apis.py:66–81  ·  view source on GitHub ↗
(self, endpoint_name: str,
                        headers: Dict[str, str]={}, ext_metadata: Dict[str, str]={})

Source from the content-addressed store, hash-verified

64 self.cookies = cookies
65
66 def _load_endpoint(self, endpoint_name: str,
67 headers: Dict[str, str]={}, ext_metadata: Dict[str, str]={}):
68 if endpoint_name in self.loaded_endpoints:
69 return
70
71 headers = {**headers, **self.headers}
72
73 # https://github.com/googleapis/googleapis/blob/f8a290120b3a67e652742a221f73778626dc3081/google/api/context.proto#L43
74 for ext_type,ext_value in ext_metadata.items():
75 ext_bin_headers = {f"X-Goog-Ext-{k}-{ext_type.title()}":v for k,v in ext_value.items()}
76 headers = {**headers, **ext_bin_headers}
77
78 if not is_headers_syntax_good(headers):
79 raise GHuntCorruptedHeadersError(f"The provided headers when loading the endpoint seems corrupted, please check it : {headers}")
80
81 self.loaded_endpoints[endpoint_name] = EndpointConfig(headers, self.cookies)
82
83 async def _check_and_gen_authorization_token(self, as_client: httpx.AsyncClient, creds: GHuntCreds):
84 async with self.gen_token_lock:

Callers 15

get_fileMethod · 0.80
get_commentsMethod · 0.80
get_childsMethod · 0.80
people_lookupMethod · 0.80
peopleMethod · 0.80
search_playerMethod · 0.80
get_player_statsMethod · 0.80
get_calendarMethod · 0.80
get_eventsMethod · 0.80
geolocateMethod · 0.80
detect_facesMethod · 0.80
get_brandMethod · 0.80

Calls 3

is_headers_syntax_goodFunction · 0.85
EndpointConfigClass · 0.85

Tested by

no test coverage detected