Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyc
ó
“tÆ_c @ sH d 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 m Z m
Z
m Z y d d l Z Wn e
k
r‘ d d l Z n Xd e f d „ ƒ YZ d e f d „ ƒ YZ d
„ Z d „ Z e e d „ Z d
e f d „ ƒ YZ d e j e f d „ ƒ YZ d „ Z d „ Z d „ Z e e d „ Z d „ Z d S( s
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
iÿÿÿÿNi ( t to_native_string( t cookielibt urlparset
urlunparset Morselt MutableMappingt MockRequestc B s¡ e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d d „ Z d „ Z d
„ Z
d „ Z e d „ ƒ Z e d
„ ƒ Z e d „ ƒ Z RS( sò Wraps a `requests.Request` to mimic a `urllib2.Request`.
The code in `cookielib.CookieJar` expects this interface in order to correctly
manage cookie policies, i.e., determine whether a cookie can be set, given the
domains of the request and the cookie.
The original request object is read-only. The client is responsible for collecting
the new headers via `get_new_headers()` and interpreting them appropriately. You
probably want `get_cookie_header`, defined below.
c C s. | | _ i | _ t | j j ƒ j | _ d S( N( t _rt _new_headersR t urlt schemet type( t selft request( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt __init__% s c C s | j S( N( R ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt get_type* s c C s t | j j ƒ j S( N( R R R t netloc( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt get_host- s c C s
| j ƒ S( N( R ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt get_origin_req_host0 s c C sx | j j j d ƒ s | j j St | j j d d d ƒ} t | j j ƒ } t | j | | j | j | j
| j g ƒ S( Nt Hostt encodings utf-8( R t headerst getR R R R R
t patht paramst queryt fragment( R t hostt parsed( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt get_full_url3 s
c C s t S( N( t True( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt is_unverifiableA s c C s | | j j k p | | j k S( N( R R R ( R t name( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
has_headerD s c C s% | j j j | | j j | | ƒ ƒ S( N( R R R R ( R R t default( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
get_headerG s c C s t d ƒ ‚ d S( sM cookielib has no legitimate use for this method; add it back if you find one.s= Cookie headers should be added with add_unredirected_header()N( t NotImplementedError( R t keyt val( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
add_headerJ s c C s | | j | <d S( N( R ( R R t value( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt add_unredirected_headerN s c C s | j S( N( R ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt get_new_headersQ s c C s
| j ƒ S( N( R ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt unverifiableT s c C s
| j ƒ S( N( R ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt origin_req_hostX s c C s
| j ƒ S( N( R ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR \ s N( t __name__t
__module__t __doc__R R R R R R R! t NoneR# R' R) R* t propertyR+ R, R ( ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR s
t MockResponsec B s) e Z d Z d „ Z d „ Z d „ Z RS( sÀ Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
...what? Basically, expose the parsed HTTP headers from the server response
the way `cookielib` expects to see them.
c C s
| | _ d S( s† Make a MockResponse for `cookielib` to read.
:param headers: a httplib.HTTPMessage or analogous carrying the headers
N( t _headers( R R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR h s c C s | j S( N( R3 ( R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt infoo s c C s | j j | ƒ d S( N( R3 t
getheaders( R R ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR5 r s ( R- R. R/ R R4 R5 ( ( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR2 a s c C sN t | d ƒ o | j s d St | ƒ } t | j j ƒ } | j | | ƒ d S( sì Extract the cookies from the response into a CookieJar.
:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object
t _original_responseN( t hasattrR6 R R2 t msgt extract_cookies( t jarR
t responset reqt res( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt extract_cookies_to_jarv s c C s, t | ƒ } | j | ƒ | j ƒ j d ƒ S( sj
Produce an appropriate Cookie header string to be sent with `request`, or None.
:rtype: str
t Cookie( R t add_cookie_headerR* R ( R: R
t r( ( sM /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt get_cookie_header‡ s
c C s¾ g } x„ | D]| } | j | k r( q
n | d k rI | | j k rI q
n | d k rj | | j k rj q
n | j | j | j | j f ƒ q
Wx* | D]"