관리-도구
편집 파일: cookies.cpython-35.pyc
��Re�G � @ sa 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 Yn XGd d � d e � Z Gd d � d e � Z d d � Z d d � Z d d d d � Z Gd d � d e � Z Gd d � d e j e � Z d d � Z d d � Z d d � Z d d d d � Z d d � Z d S)z� requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports. � N� )�to_native_string)� cookielib�urlparse� urlunparse�Morsel�MutableMappingc @ s� e Z d Z d Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d d � Z d d � Z d d � Z d d � Z e d d � � Z e d d � � Z e d d � � Z d S)�MockRequesta� 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)�_r�_new_headersr �url�scheme�type)�self�request� r ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.py�__init__% s zMockRequest.__init__c C s | j S)N)r )r r r r �get_type* s zMockRequest.get_typec C s t | j j � j S)N)r r r �netloc)r r r r �get_host- s zMockRequest.get_hostc C s | j � S)N)r )r r r r �get_origin_req_host0 s zMockRequest.get_origin_req_hostc 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)N�Host�encodingzutf-8)r �headers�getr r r r r �path�params�query�fragment)r �host�parsedr r r �get_full_url3 s zMockRequest.get_full_urlc C s d S)NTr )r r r r �is_unverifiableA s zMockRequest.is_unverifiablec C s | | j j k p | | j k S)N)r r r )r �namer r r � has_headerD s zMockRequest.has_headerNc C s% | j j j | | j j | | � � S)N)r r r r )r r$ �defaultr r r � get_headerG s zMockRequest.get_headerc C s t d � � d S)zMcookielib has no legitimate use for this method; add it back if you find one.z=Cookie headers should be added with add_unredirected_header()N)�NotImplementedError)r �key�valr r r � add_headerJ s zMockRequest.add_headerc C s | | j | <d S)N)r )r r$ �valuer r r �add_unredirected_headerN s z#MockRequest.add_unredirected_headerc C s | j S)N)r )r r r r �get_new_headersQ s zMockRequest.get_new_headersc C s | j � S)N)r# )r r r r �unverifiableT s zMockRequest.unverifiablec C s | j � S)N)r )r r r r �origin_req_hostX s zMockRequest.origin_req_hostc C s | j � S)N)r )r r r r r \ s zMockRequest.host)�__name__� __module__�__qualname__�__doc__r r r r r"