Python Glossary Русский

all Python 3urllib.requestterm

urllib.request.AbstractDigestAuthHandler

authentication

The shared part of Digest authentication for sites and proxies: instead of the password it sends a hash of the password, the server nonce and the request.

Syntax

class urllib.request.AbstractDigestAuthHandler(password_mgr=None)

The password itself never crosses the network, but the default algorithm is MD5, so Digest is no substitute for HTTPS (SHA-256 is supported since 3.14). It is a mixin: use its subclasses HTTPDigestAuthHandler and ProxyDigestAuthHandler. For a scheme other than Digest or Basic it raises ValueError; a Basic challenge is silently skipped and left to HTTPBasicAuthHandler.

Examples

import urllib.request
for cls in (urllib.request.HTTPDigestAuthHandler, urllib.request.ProxyDigestAuthHandler):
    print(cls.__name__, issubclass(cls, urllib.request.AbstractDigestAuthHandler))
# → HTTPDigestAuthHandler True / ProxyDigestAuthHandler True

See also

Common errors

Open in the full glossarydocs.python.orgReport an inaccuracy