(self, endpoint_name: str,
headers: Dict[str, str]={}, ext_metadata: Dict[str, str]={})
| 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: |
no test coverage detected