σ `8(Zc@@sbddlmZddlZddlZddlZddlmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZdd lmZydd lmZWnek rίdZnXejeƒZd efd „ƒYZd efd„ƒYZdefd„ƒYZd„Z d„Z!d„Z"d„Z#d„Z$dS(i(tabsolute_importNi(t HTTPErrort HTTPWarningt MaxRetryErrort ProtocolErrort TimeoutErrortSSLError(tBytesIO(tRequestMethods(t HTTPResponse(tTimeout(tRetry(turlfetchtAppEnginePlatformWarningcB@seZRS((t__name__t __module__(((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyR stAppEnginePlatformErrorcB@seZRS((RR(((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyR"stAppEngineManagercB@sheZdZdded„Zd„Zd„Zdddeej d„Z d„Z d„Z d„Z RS( s Connection manager for Google App Engine sandbox applications. This manager uses the URLFetch service directly instead of using the emulated httplib, and is subject to URLFetch limitations as described in the App Engine documentation here: https://cloud.google.com/appengine/docs/python/urlfetch Notably it will raise an AppEnginePlatformError if: * URLFetch is not available. * If you attempt to use this on GAEv2 (Managed VMs), as full socket support is available. * If a request size is more than 10 megabytes. * If a response size is more than 32 megabtyes. * If you use an unsupported request method such as OPTIONS. Beyond those cases, it will raise normal urllib3 errors. cC@sltstdƒ‚ntƒr-tdƒ‚ntjdtƒtj||ƒ||_|pbt j |_ dS(Ns.URLFetch is not available in this environment.sUse normal urllib3.PoolManager instead of AppEngineManageron Managed VMs, as using URLFetch is not necessary in this environment.s±urllib3 is using URLFetch on Google App Engine sandbox instead of sockets. To use sockets directly instead of URLFetch see https://urllib3.readthedocs.io/en/latest/contrib.html.( R Rtis_prod_appengine_mvmstwarningstwarnR Rt__init__tvalidate_certificateR tDEFAULTtretries(tselftheadersRR((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyR;s    cC@s|S(N((R((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyt __enter__QscC@stS(N(tFalse(Rtexc_typetexc_valtexc_tb((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyt__exit__Tsc K@se|j||ƒ}ygtj|d|d|d|p6idtd|oZ|jdkoZ|jd|j|ƒd|jƒ} Wn"tjk r } t || ƒ‚nώtj k rε} d t | ƒkrΦt d | ƒ‚nt | ƒ‚nΉtjk r0} d t | ƒkr!t||d | ƒ‚nt | ƒ‚nntjk rT} t d | ƒ‚nJtjk ru} t| ƒ‚n)tjk r} t d|| ƒ‚nX|j| |} | jƒrΰ|jrΰ|rΰt||dƒ‚n|j|d| jƒra|j||d| d|ƒ}tjd|ƒ|jƒ|j||d|d|d|d|d||S| S(NtpayloadtmethodRtallow_truncatedtfollow_redirectsitdeadlineRs too largesOURLFetch request too large, URLFetch only supports requests up to 10mb in size.sToo many redirectstreasonsPURLFetch response too large, URLFetch only supportsresponses up to 32mb in size.s$URLFetch does not support method: %sstoo many redirectst status_codetresponset_poolsForced retry: %stbodyRtredirectttimeout(t _get_retriesR tfetchRR+ttotalt_get_absolute_timeoutRtDeadlineExceededErrorRtInvalidURLErrortstrRRt DownloadErrorRtResponseTooLargeErrortSSLCertificateErrorRtInvalidMethodErrort#_urlfetch_response_to_http_responsetget_redirect_locationtraise_on_redirecttis_forced_retrytstatust incrementtlogtinfotsleepturlopen( RR"turlR*RRR+R,t response_kwR(tet http_response((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyRAXsd           cK@s΅tƒr7|jjdƒ}|dkr7|jd=q7n|jjdƒ}|dkrŠ|jdƒ}|jdƒdj|ƒ|jdR RRR_R`R^RIR(((sT/tmp/pip-build-0nEYGB/pip/pip/_vendor/requests/packages/urllib3/contrib/appengine.pyts,   .   «