/usr/lib/python3.9/site-packages/urllib3/contrib/__pycache__
NameSizeModeActions
appengine.cpython-39.opt-1.pyc82000644editdlrm
appengine.cpython-39.pyc82000644editdlrm
ntlmpool.cpython-39.opt-1.pyc32160644editdlrm
ntlmpool.cpython-39.pyc32160644editdlrm
pyopenssl.cpython-39.opt-1.pyc155220644editdlrm
pyopenssl.cpython-39.pyc155220644editdlrm
securetransport.cpython-39.opt-1.pyc217860644editdlrm
securetransport.cpython-39.pyc218380644editdlrm
socks.cpython-39.opt-1.pyc55870644editdlrm
socks.cpython-39.pyc55870644editdlrm
_appengine_environ.cpython-39.opt-1.pyc13710644editdlrm
_appengine_environ.cpython-39.pyc13710644editdlrm
__init__.cpython-39.opt-1.pyc1510644editdlrm
__init__.cpython-39.pyc1510644editdlrm
Edit: /usr/lib/python3.9/site-packages/urllib3/contrib/__pycache__/appengine.cpython-39.pyc (8200B)
a t~®`+ã@sdZddlmZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZddlmZddlmZdd lmZdd lmZd d lmZzdd lmZWney¶dZYn0e e¡ZGdd„deƒZGdd„deƒZ Gdd„deƒZ!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&dS)aC This module provides a pool manager that uses Google App Engine's `URLFetch Service `_. Example usage:: from urllib3 import PoolManager from urllib3.contrib.appengine import AppEngineManager, is_appengine_sandbox if is_appengine_sandbox(): # AppEngineManager uses AppEngine's URLFetch API behind the scenes http = AppEngineManager() else: # PoolManager uses a socket-level API behind the scenes http = PoolManager() r = http.request('GET', 'https://google.com/') There are `limitations `_ to the URLFetch service and it may not be the best choice for your application. There are three options for using urllib3 on Google App Engine: 1. You can use :class:`AppEngineManager` with URLFetch. URLFetch is cost-effective in many circumstances as long as your usage is within the limitations. 2. You can use a normal :class:`~urllib3.PoolManager` by enabling sockets. Sockets also have `limitations and restrictions `_ and have a lower free quota than URLFetch. To use sockets, be sure to specify the following in your ``app.yaml``:: env_variables: GAE_USE_SOCKETS_HTTPLIB : 'true' 3. If you are using `App Engine Flexible `_, you can use the standard :class:`PoolManager` without any configuration or special environment variables. é)Úabsolute_importNé)Ú HTTPErrorÚ HTTPWarningÚ MaxRetryErrorÚ ProtocolErrorÚSSLErrorÚ TimeoutError)Úurljoin)ÚRequestMethods)Ú HTTPResponse)ÚRetry)ÚTimeouté)Ú_appengine_environ)Úurlfetchc@s eZdZdS)ÚAppEnginePlatformWarningN©Ú__name__Ú __module__Ú __qualname__©rrú=/usr/lib/python3.9/site-packages/urllib3/contrib/appengine.pyrGsrc@s eZdZdS)ÚAppEnginePlatformErrorNrrrrrrKsrc@sXeZdZdZddd„Zdd„Zdd „Zddddejfd d „Z d d „Z dd„Z dd„Z dS)ÚAppEngineManagera  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 `_. Notably it will raise an :class:`AppEnginePlatformError` if: * URLFetch is not available. * If you attempt to use this on App Engine Flexible, as full socket support is available. * If a request size is more than 10 megabytes. * If a response size is more than 32 megabytes. * If you use an unsupported request method such as OPTIONS. Beyond those cases, it will raise normal urllib3 errors. NTcCs@ts tdƒ‚t dt¡t ||¡||_||_|p8t j |_ dS)Nz.URLFetch is not available in this environment.zÃ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/reference/urllib3.contrib.html.) rrÚwarningsÚwarnrr Ú__init__Úvalidate_certificateÚurlfetch_retriesr ZDEFAULTÚretries)ÚselfÚheadersr rrrrrrcsÿü zAppEngineManager.__init__cCs|S)Nr)r!rrrÚ __enter__|szAppEngineManager.__enter__cCsdS)NFr)r!Úexc_typeZexc_valZexc_tbrrrÚ__exit__szAppEngineManager.__exit__c Ksì| ||¡}zF|o |jdko |j} tj||||p2id|jo<| | |¡|jd�} W�nNtjy„} zt || ƒ‚WYd} ~ �n&d} ~ 0tj yÆ} z*dt | ƒvrªt d| ƒ‚t | ƒ‚WYd} ~ näd} ~ 0tj�y} z.dt | ƒvròt||| d�‚t | ƒ‚WYd} ~ nœd} ~ 0tj�y>} zt d| ƒ‚WYd} ~ nld} ~ 0tj�yl} zt| ƒ‚WYd} ~ n>d} ~ 0tj�y } zt d || ƒ‚WYd} ~ n d} ~ 00|j| fd |i|¤Ž} |�oÄ|  ¡} | �r€|j�rê|j�rêt||d ƒ‚n–| jd k�rúd }z|j||| |d�}Wn,t�y<|j�r4t||d ƒ‚| YS0| | ¡t d|| ¡t|| ƒ}|j||||f|||dœ|¤ŽSt|  d¡ƒ}|  || j|¡�rè|j||| |d�}t d|¡| !| ¡|j||f|||||dœ|¤ŽS| S)NrF)ZpayloadÚmethodr"Zallow_truncatedÚfollow_redirectsZdeadlinerz too largezOURLFetch request too large, URLFetch only supports requests up to 10mb in size.zToo many redirects)ÚreasonzPURLFetch response too large, URLFetch only supportsresponses up to 32mb in size.z$URLFetch does not support method: %sr ztoo many redirectsi/ZGET)ÚresponseZ_poolzRedirecting %s -> %s)r ÚredirectÚtimeoutz Retry-Afterz Retry: %s)Úbodyr"r r*r+)"Ú _get_retriesr*ÚtotalrZfetchrÚ_get_absolute_timeoutrZDeadlineExceededErrorr ZInvalidURLErrorÚstrrrZ DownloadErrorrZResponseTooLargeErrorZSSLCertificateErrorrZInvalidMethodErrorÚ#_urlfetch_response_to_http_responseZget_redirect_locationZraise_on_redirectÚstatusZ incrementZsleep_for_retryÚlogÚdebugr ÚurlopenÚboolZ getheaderZis_retryÚsleep)r!r&Úurlr,r"r r*r+Ú response_kwr'r)ÚeZ http_responseZredirect_locationZ redirect_urlZhas_retry_afterrrrr5ƒs¶ ø   ý ýÿÿÿÿ ÿ     üùø   þùø zAppEngineManager.urlopencKs¤tƒr"|j d¡}|dkr"|jd=|j d¡}|dkrZ| d¡}| d¡d |¡|jd<tft |j ¡|j |j|j dœ|¤Ž}tft |j ¡|j|j |dœ|¤ŽS)Nzcontent-encodingZdeflateztransfer-encodingZchunkedú,)r,Úmsgr"r2)r,r"r2Úoriginal_response) Úis_prod_appenginer"ÚgetÚsplitÚremoveÚjoinr ÚioÚBytesIOZcontentZ header_msgZ status_code)r!Z urlfetch_respr9Zcontent_encodingZtransfer_encodingÚ encodingsr=rrrr1õs2     úù  üûz4AppEngineManager._urlfetch_response_to_http_responsecCsB|tjurdSt|tƒr>|jdus,|jdur8t dt¡|jS|S)NzdURLFetch does not support granular timeout settings, reverting to total or default URLFetch timeout.) rÚDEFAULT_TIMEOUTÚ isinstanceZ_readZ_connectrrrr.)r!r+rrrr/s  ýz&AppEngineManager._get_absolute_timeoutcCs>t|tƒstj|||jd�}|js.|js.|jr:t dt ¡|S)N)r*ÚdefaultzhURLFetch only supports total retries and does not recognize connect, read, or redirect retry parameters.) rGr Zfrom_intr ZconnectÚreadr*rrr)r!r r*rrrr-&s ýzAppEngineManager._get_retries)NNTT) rrrÚ__doc__rr#r%rrFr5r1r/r-rrrrrOs"û ø r$ r)'rJZ __future__rrCZloggingrÚ exceptionsrrrrrr Zpackages.six.moves.urllib.parser Zrequestr r)r Z util.retryr Z util.timeoutrÚrZgoogle.appengine.apirÚ ImportErrorZ getLoggerrr3rrrZ is_appengineZis_appengine_sandboxZis_local_appenginer>Zis_prod_appengine_mvmsrrrrÚs2(           h