� ��^c@sHdZddlZddlZddlZddlmZddlmZmZm Z m Z m Z yddl Z Wne k r�ddlZ nXdefd��YZdefd ��YZd �Zd �Zeed �Zd efd��YZdeje fd��YZd�Zd�Zd�Zeed�Zd�ZdS(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(tto_native_string(t cookielibturlparset urlunparsetMorseltMutableMappingt MockRequestcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z dd�Z d �Z d �Z d �Zed ��Zed ��Zed��ZRS(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. cCs.||_i|_t|jj�j|_dS(N(t_rt _new_headersRturltschemettype(tselftrequest((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pyt__init__%s  cCs|jS(N(R (R ((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pytget_type*scCst|jj�jS(N(RRR tnetloc(R ((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pytget_host-scCs |j�S(N(R(R ((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pytget_origin_req_host0scCsx|jjjd�s|jjSt|jjddd�}t|jj�}t|j||j|j |j |j g�S(NtHosttencodingsutf-8( RtheaderstgetR RRRR tpathtparamstquerytfragment(R thosttparsed((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pyt get_full_url3s cCstS(N(tTrue(R ((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pytis_unverifiableAscCs||jjkp||jkS(N(RRR(R tname((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pyt has_headerDscCs%|jjj||jj||��S(N(RRRR(R R tdefault((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pyt get_headerGscCstd��dS(sMcookielib 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(tNotImplementedError(R tkeytval((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pyt add_headerJscCs||j|RBR0RIt RuntimeErrorRJRpRKR�RPRORR�R�(((s2/tmp/pip-build-1THPZW/requests/requests/cookies.pyt s*   ( H  �  $