ó  fH^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((srequests/cookies.pyt__init__%s  cCs|jS(N(R (R ((srequests/cookies.pytget_type*scCst|jjƒjS(N(RRR tnetloc(R ((srequests/cookies.pytget_host-scCs |jƒS(N(R(R ((srequests/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((srequests/cookies.pyt get_full_url3s cCstS(N(tTrue(R ((srequests/cookies.pytis_unverifiableAscCs||jjkp||jkS(N(RRR(R tname((srequests/cookies.pyt has_headerDscCs%|jjj||jj||ƒƒS(N(RRRR(R R tdefault((srequests/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((srequests/cookies.pyt add_headerJscCs||j|RBR0RIt RuntimeErrorRJRpRKRƒRPRORR¥Rª(((srequests/cookies.pyt s*   ( H  ÿ  $