Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Disable Function : NONE
ó
4£ëTc @ s d Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z d d l
m Z d d l m
Z
m Z d d l m Z d Z d
Z d „ Z d e f d
„ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d S( s]
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
iÿÿÿÿN( t b64encodei ( t urlparset str( t extract_cookies_to_jar( t parse_dict_headert to_native_string( t codess! application/x-www-form-urlencodeds multipart/form-datac C s3 d t t d | | f j d ƒ ƒ j ƒ ƒ } | S( s Returns a Basic Auth string.s Basic s %s:%st latin1( R R t encodet strip( t usernamet passwordt authstr( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt _basic_auth_str s )t AuthBasec B s e Z d Z d „ Z RS( s4 Base class that all auth implementations derive fromc C s t d ƒ ‚ d S( Ns Auth hooks must be callable.( t NotImplementedError( t selft r( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt __call__' s ( t __name__t
__module__t __doc__R ( ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR $ s t
HTTPBasicAuthc B s e Z d Z d „ Z d „ Z RS( s? Attaches HTTP Basic Authentication to the given Request object.c C s | | _ | | _ d S( N( R
R ( R R
R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt __init__- s c C s t | j | j ƒ | j d <| S( Nt
Authorization( R
R
R t headers( R R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR 1 s ( R R R R R ( ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR + s t
HTTPProxyAuthc B s e Z d Z d „ Z RS( s= Attaches HTTP Proxy Authentication to a given Request object.c C s t | j | j ƒ | j d <| S( Ns Proxy-Authorization( R
R
R R ( R R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR 8 s ( R R R R ( ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR 6 s t HTTPDigestAuthc B s; e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( s@ Attaches HTTP Digest Authentication to the given Request object.c C sC | | _ | | _ d | _ d | _ i | _ d | _ d | _ d S( Nt i i ( R
R t
last_noncet nonce_countt chalt Nonet post
num_401_calls( R R
R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR ? s c s' | j d } | j d } | j j d ƒ } | j j d ƒ } | j j d ƒ } | d k re d } n | j ƒ } | d k s‰ | d k r› d „ } | ‰ n | d k r¹ d
„ }
|
‰ n ‡ f d † } ˆ d k rØ d Sd } t | ƒ }
|
j } |
j r| d |
j 7} n d
| j | | j f } d | | f } ˆ | ƒ } ˆ | ƒ } | | j k rr| j
d 7_
n d | _
d | j
} t | j
ƒ j d ƒ } | | j d ƒ 7} | t
j ƒ j d ƒ 7} | t j d ƒ 7} t j | ƒ j ƒ d } | d k r ˆ d
| | | f ƒ } n | d k rH| | d | | f ƒ } nP | d k sid | j d ƒ k r”d | | | d | f } | | | ƒ } n d S| | _ d | j | | | | f } | rÔ| d | 7} n | rë| d | 7} n | r| d | 7} n | r| d | | f 7} n d | S( Nt realmt noncet qopt algorithmt opaquet MD5s MD5-SESSc S s4 t | t ƒ r! | j d ƒ } n t j | ƒ j ƒ S( Ns utf-8( t
isinstanceR R t hashlibt md5t hexdigest( t x( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt md5_utf8V s t SHAc S s4 t | t ƒ r! | j d ƒ } n t j | ƒ j ƒ S( Ns utf-8( R) R R R* t sha1R, ( R- ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt sha_utf8\ s c s ˆ d | | f ƒ S( Ns %s:%s( ( t st d( t hash_utf8( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt b s t ?s %s:%s:%ss %s:%si s %08xs utf-8i i t autht ,s %s:%s:%s:%s:%ss> username="%s", realm="%s", nonce="%s", uri="%s", response="%s"s
, opaque="%s"s , algorithm="%s"s
, digest="%s"s , qop="auth", nc=%s, cnonce="%s"s Digest %s( R t getR t upperR t patht queryR
R R R R R t timet ctimet ost urandomR* R0 R, t split( R t methodt urlR# R$ R% R&