Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_digest_auth_compat.py30 linesDownload Raw Back to auth
1"""Provide a compatibility layer for requests.auth.HTTPDigestAuth."""2import requests3 4 5class _ThreadingDescriptor(object):6    def __init__(self, prop, default):7        self.prop = prop8        self.default = default9 10    def __get__(self, obj, objtype=None):11        return getattr(obj._thread_local, self.prop, self.default)12 13    def __set__(self, obj, value):14        setattr(obj._thread_local, self.prop, value)15 16 17class _HTTPDigestAuth(requests.auth.HTTPDigestAuth):18    init = _ThreadingDescriptor('init', True)19    last_nonce = _ThreadingDescriptor('last_nonce', '')20    nonce_count = _ThreadingDescriptor('nonce_count', 0)21    chal = _ThreadingDescriptor('chal', {})22    pos = _ThreadingDescriptor('pos', None)23    num_401_calls = _ThreadingDescriptor('num_401_calls', 1)24 25 26if requests.__build__ < 0x020800:27    HTTPDigestAuth = requests.auth.HTTPDigestAuth28else:29    HTTPDigestAuth = _HTTPDigestAuth30 
codekingpro/portable-devtools · Team Ai