Skip to content
Myr

Small namedtuple refactor (#1329)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Plus order consistency because why not..

authored by Johannes · committed by GitHub · parent a7a76fb · Browse files · 1 file+9 added−17 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−17 removed

  • other:+9 added−17 removed

1 file+9 added−17 removed

modified:httpx/_auth.py+9 added-17 removed
195 unmodified lines
196197 try:198 realm = header_dict["realm"].encode()199 nonce = header_dict["nonce"].encode()200 qop = header_dict["qop"].encode() if "qop" in header_dict else None201 opaque = header_dict["opaque"].encode() if "opaque" in header_dict else None200 algorithm = header_dict.get("algorithm", "MD5")201 opaque = header_dict["opaque"].encode() if "opaque" in header_dict else None202 qop = header_dict["qop"].encode() if "qop" in header_dict else None203 return _DigestAuthChallenge(204 realm=realm, nonce=nonce, qop=qop, opaque=opaque, algorithm=algorithm204 realm=realm, nonce=nonce, algorithm=algorithm, opaque=opaque, qop=qop205 )206 except KeyError as exc:207 message = "Malformed Digest WWW-Authenticate header"208 raise ProtocolError(message, request=request) from exc
86 unmodified lines
295 message = f'Unexpected qop value "{qop!r}" in digest auth'296 raise ProtocolError(message, request=request)297298299class _DigestAuthChallenge:300 def __init__(301 self,302 realm: bytes,303 nonce: bytes,304 algorithm: str,305 opaque: typing.Optional[bytes] = None,306 qop: typing.Optional[bytes] = None,299class _DigestAuthChallenge(typing.NamedTuple):300 realm: bytes301 nonce: bytes302 algorithm: str303 opaque: typing.Optional[bytes]304 qop: typing.Optional[bytes]307 ) -> None:308 self.realm = realm309 self.nonce = nonce310 self.algorithm = algorithm311 self.opaque = opaque312 self.qop = qop