MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / _encode_credentials

Method _encode_credentials

examples/basic_auth_middleware.py:39–43  ·  view source on GitHub ↗

Encode username and password to base64.

(self)

Source from the content-addressed store, hash-verified

37 self._auth_header = self._encode_credentials()
38
39 def _encode_credentials(self) -> str:
40 """Encode username and password to base64."""
41 credentials = f"{self.username}:{self.password}"
42 encoded = base64.b64encode(credentials.encode()).decode()
43 return f"Basic {encoded}"
44
45 async def __call__(
46 self,

Callers 1

__init__Method · 0.95

Calls 2

encodeMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected