/opt/alt/python37/lib/python3.7/site-packages/requests/__pycache__
NameSizeModeActions
adapters.cpython-37.opt-1.pyc167740644editdlrm
adapters.cpython-37.pyc167740644editdlrm
api.cpython-37.opt-1.pyc66480644editdlrm
api.cpython-37.pyc66480644editdlrm
auth.cpython-37.opt-1.pyc83130644editdlrm
auth.cpython-37.pyc83130644editdlrm
certs.cpython-37.opt-1.pyc8140644editdlrm
certs.cpython-37.pyc8140644editdlrm
compat.cpython-37.opt-1.pyc16760644editdlrm
compat.cpython-37.pyc16760644editdlrm
cookies.cpython-37.opt-1.pyc187480644editdlrm
cookies.cpython-37.pyc187480644editdlrm
exceptions.cpython-37.opt-1.pyc56240644editdlrm
exceptions.cpython-37.pyc56240644editdlrm
help.cpython-37.opt-1.pyc28100644editdlrm
help.cpython-37.pyc28100644editdlrm
hooks.cpython-37.opt-1.pyc9410644editdlrm
hooks.cpython-37.pyc9410644editdlrm
models.cpython-37.opt-1.pyc246170644editdlrm
models.cpython-37.pyc246170644editdlrm
packages.cpython-37.opt-1.pyc6720644editdlrm
packages.cpython-37.pyc6720644editdlrm
sessions.cpython-37.opt-1.pyc197840644editdlrm
sessions.cpython-37.pyc197840644editdlrm
status_codes.cpython-37.opt-1.pyc41860644editdlrm
status_codes.cpython-37.pyc41860644editdlrm
structures.cpython-37.opt-1.pyc43700644editdlrm
structures.cpython-37.pyc43700644editdlrm
utils.cpython-37.opt-1.pyc230530644editdlrm
utils.cpython-37.pyc230530644editdlrm
_internal_utils.cpython-37.opt-1.pyc12270644editdlrm
_internal_utils.cpython-37.pyc12690644editdlrm
__init__.cpython-37.opt-1.pyc36200644editdlrm
__init__.cpython-37.pyc38410644editdlrm
__version__.cpython-37.opt-1.pyc5160644editdlrm
__version__.cpython-37.pyc5160644editdlrm
Edit: /opt/alt/python37/lib/python3.7/site-packages/requests/__pycache__/models.cpython-37.pyc (24617B)
B ^`+@sdZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZmZddlmZdd lmZdd lmZdd lmZdd lmZmZmZdd lmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ddl%m&Z&m'Z'ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>m?Z?ddl3m@ZAddlBmCZCeCjDeCjEeCjFeCjGeCjHfZIdZJdZKdZLGdddeMZNGdddeMZOGdddeOZPGdddeNeOZQGdddeMZRdS) z` requests.models ~~~~~~~~~~~~~~~ This module contains the primary objects that power Requests. N) RequestField)encode_multipart_formdata) parse_url) DecodeErrorReadTimeoutError ProtocolErrorLocationParseError)UnsupportedOperation) default_hooks)CaseInsensitiveDict) HTTPBasicAuth)cookiejar_from_dictget_cookie_header_copy_cookie_jar) HTTPError MissingSchema InvalidURLChunkedEncodingErrorContentDecodingErrorConnectionErrorStreamConsumedErrorInvalidJSONError)to_native_stringunicode_is_ascii) guess_filenameget_auth_from_url requote_uristream_decode_response_unicodeto_key_val_listparse_header_links iter_slicesguess_json_utf super_lencheck_header_validity) CallableMapping cookielib urlunparseurlsplit urlencodestrbytesis_py2chardet builtin_str basestring)json)codesi(ic@s0eZdZeddZeddZeddZdS)RequestEncodingMixincCsNg}t|j}|j}|sd}|||j}|rD|d||d|S)zBuild the path URL to use./?)r)urlpathappendqueryjoin)selfr8pr9r;r?@/opt/alt/python37/lib/python3.7/site-packages/requests/models.pypath_url=s    zRequestEncodingMixin.path_urlcCst|ttfr|St|dr |St|drg}xzt|D]n\}}t|tsTt|dsZ|g}xJ|D]B}|dk r`|t|tr|dn|t|tr|dn|fq`Wq8Wt|ddS|SdS)zEncode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. read__iter__Nzutf-8T)Zdoseq) isinstancer+r,hasattrrr0r:encoder*)dataresultkZvsvr?r?r@_encode_paramsRs    $ z#RequestEncodingMixin._encode_paramscCs|stdnt|tr tdg}t|p,i}t|p8i}x|D]\}}t|ts^t|dsd|g}x\|D]T}|dk rjt|tst|}|t|tr|dn|t|tr| dn|fqjWqBWx|D]\}}d}d} t|t t fr,t |dkr|\} } n&t |dkr|\} } }n |\} } }} nt |p8|} |} t| tttfrV| } n(t| drl| } n| dkrzqn| } t|| | | d } | j|d || qWt|\}}||fS) aBuild the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tuples (filename, fileobj, contentype, custom_headers). zFiles must be provided.zData must not be a string.rCNzutf-8rB)namerGfilenameheaders) content_type) ValueErrorrDr0rrEr,r+r:decoderFtuplelistlenr bytearrayrBrZmake_multipartr)filesrGZ new_fieldsZfieldsZfieldvalrJrIZftZfhfnfpZfdataZrfbodyrQr?r?r@ _encode_filesmsP       $       z"RequestEncodingMixin._encode_filesN)__name__ __module__ __qualname__propertyrA staticmethodrKr]r?r?r?r@r4<s  r4c@seZdZddZddZdS)RequestHooksMixincCsZ||jkrtd|t|tr2|j||n$t|drV|j|dd|DdS)zProperly register a hook.z1Unsupported event specified, with event name "%s"rCcss|]}t|tr|VqdS)N)rDr%).0hr?r?r@ sz2RequestHooksMixin.register_hook..N)hooksrRrDr%r:rEextend)r=eventhookr?r?r@ register_hooks     zRequestHooksMixin.register_hookcCs.y|j||dStk r(dSXdS)ziDeregister a previously registered hook. Returns True if the hook existed, False if not. TFN)rgremoverR)r=rirjr?r?r@deregister_hooks z!RequestHooksMixin.deregister_hookN)r^r_r`rkrmr?r?r?r@rcs rcc @s*eZdZdZd ddZddZddZdS) Requesta{A user-created :class:`Request ` object. Used to prepare a :class:`PreparedRequest `, which is sent to the server. :param method: HTTP method to use. :param url: URL to send. :param headers: dictionary of headers to send. :param files: dictionary of {filename: fileobject} files to multipart upload. :param data: the body to attach to the request. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param json: json for the body to attach to the request (if files or data is not specified). :param params: URL parameters to append to the URL. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param auth: Auth handler or (user, pass) tuple. :param cookies: dictionary or CookieJar of cookies to attach to this request. :param hooks: dictionary of callback hooks, for internal usage. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> req.prepare() Nc Cs|dkr gn|}|dkrgn|}|dkr,in|}|dkr)rp)r=r?r?r@__repr__szRequest.__repr__c Cs<t}|j|j|j|j|j|j|j|j|j |j |j d |S)zXConstructs a :class:`PreparedRequest ` for transmission and returns it.) rpr8rPrXrGr1rqrrrsrg) PreparedRequestpreparerpr8rPrXrGr1rqrrrsrg)r=r>r?r?r@rws zRequest.prepare) NNNNNNNNNN)r^r_r`__doc__rtrurwr?r?r?r@rns  rnc @seZdZdZddZdddZddZd d Zd d Ze d dZ ddZ ddZ dddZ ddZd ddZddZddZdS)!rva)The fully mutable :class:`PreparedRequest ` object, containing the exact bytes that will be sent to the server. Instances are generated from a :class:`Request ` object, and should not be instantiated manually; doing so may produce undesirable effects. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> r = req.prepare() >>> r >>> s = requests.Session() >>> s.send(r) cCs0d|_d|_d|_d|_d|_t|_d|_dS)N)rpr8rP_cookiesr\r rg_body_position)r=r?r?r@rt%szPreparedRequest.__init__Nc CsR||||||||||||| ||||| dS)z6Prepares the entire request with the given parameters.N)prepare_method prepare_urlprepare_headersprepare_cookies prepare_body prepare_auth prepare_hooks) r=rpr8rPrXrGrqrrrsrgr1r?r?r@rw6s     zPreparedRequest.preparecCs d|jS)Nz)rp)r=r?r?r@ruHszPreparedRequest.__repr__cCsXt}|j|_|j|_|jdk r*|jnd|_t|j|_|j|_|j|_|j |_ |S)N) rvrpr8rPcopyrryr\rgrz)r=r>r?r?r@rKs zPreparedRequest.copycCs$||_|jdk r t|j|_dS)zPrepares the given HTTP method.N)rprupper)r=rpr?r?r@r{Vs zPreparedRequest.prepare_methodcCs@ddl}y|j|ddd}Wn|jk r:tYnX|S)NrT)Zuts46zutf-8)idnarFrSZ IDNAError UnicodeError)hostrr?r?r@_get_idna_encoded_host\s  z&PreparedRequest._get_idna_encoded_hostc Cs,t|tr|d}ntr"t|nt|}|}d|krR|dsR||_ dSyt |\}}}}}}} Wn,t k r} zt | j Wdd} ~ XYnX|sd} | t|d} t| |st d|t|sy||}Wntk rt dYnXn|drt d|pd } | r.| d 7} | |7} |rL| dt|7} |sVd }trt|trr|d }t| tr| d } t|tr|d }t|tr|d }t| tr| d } t|ttfrt|}||} | r |rd || f}n| }tt|| |d|| g}||_ dS)zPrepares the given HTTP URL.utf8:ZhttpNzDInvalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?z Invalid URL %r: No host suppliedzURL has an invalid label.*r7@r5zutf-8z%s&%s)rDr,rSr-Zunicoder+lstriplower startswithr8rrrargsformatrrrrrrFrKrr()r=r8rqZschemerrrZportr9r;ZfragmenteerrorZnetlocZ enc_paramsr?r?r@r|fsh                 zPreparedRequest.prepare_urlcCs@t|_|rPrepare Content-Length header based on request method and bodyNzContent-Length)ZGETZHEAD0)r#r/rPrpget)r=r\rr?r?r@rs z&PreparedRequest.prepare_content_lengthr7cCsj|dkr"t|j}t|r|nd}|rft|trDt|dkrDt|}||}|j|j| |j dS)z"Prepares the given HTTP auth data.NrL) rr8anyrDrTrVr __dict__updaterr\)r=rrr8Zurl_authrr?r?r@rs zPreparedRequest.prepare_authcCs@t|tjr||_n t||_t|j|}|dk r<||jd<dS)aPrepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function can only be called once for the life of the :class:`PreparedRequest ` object. Any subsequent calls to ``prepare_cookies`` will have no actual effect, unless the "Cookie" header is removed beforehand. NZCookie)rDr'Z CookieJarryrrrP)r=rsZ cookie_headerr?r?r@r~4s   zPreparedRequest.prepare_cookiescCs*|pg}x|D]}||||qWdS)zPrepares the given hooks.N)rk)r=rgrir?r?r@rHs zPreparedRequest.prepare_hooks) NNNNNNNNNN)N)r7)r^r_r`rxrtrwrurr{rbrr|r}rrrr~rr?r?r?r@rvs   V J rvc @seZdZdZdddddddd d d g Zd d ZddZddZddZddZ ddZ ddZ ddZ ddZ eddZed d!Zed"d#Zed$d%Zed&d'Zd;d*d+Zed)d,fd-d.Zed/d0Zed1d2Zd3d4Zed5d6Zd7d8Zd9d:Zd,S)<ResponsezhThe :class:`Response ` object, which contains a server's response to an HTTP request. _content status_coderPr8historyencodingreasonrselapsedrcCs^d|_d|_d|_d|_t|_d|_d|_d|_g|_ d|_ t i|_ t d|_d|_dS)NFr)r_content_consumed_nextrr rPrawr8rrrrrsdatetimeZ timedeltarr)r=r?r?r@rt\s  zResponse.__init__cCs|S)Nr?)r=r?r?r@ __enter__szResponse.__enter__cGs |dS)N)close)r=rr?r?r@__exit__szResponse.__exit__cs js jfddjDS)Ncsi|]}t|d|qS)N)r)rdattr)r=r?r@ sz)Response.__getstate__..)rcontent __attrs__)r=r?)r=r@ __getstate__szResponse.__getstate__cCs>x |D]\}}t|||q Wt|ddt|dddS)NrTr)rosetattr)r=staterNrr?r?r@ __setstate__s zResponse.__setstate__cCs d|jS)Nz)r)r=r?r?r@ruszResponse.__repr__cCs|jS)akReturns True if :attr:`status_code` is less than 400. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code, is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. )ok)r=r?r?r@__bool__szResponse.__bool__cCs|jS)akReturns True if :attr:`status_code` is less than 400. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code, is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. )r)r=r?r?r@ __nonzero__szResponse.__nonzero__cCs |dS)z,Allows you to use a response as an iterator.) iter_content)r=r?r?r@rCszResponse.__iter__cCs&y |Wntk r dSXdS)axReturns True if :attr:`status_code` is less than 400, False if not. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. FT)raise_for_statusr)r=r?r?r@rs  z Response.okcCsd|jko|jtkS)zTrue if this Response is a well-formed HTTP redirect that could have been processed automatically (by :meth:`Session.resolve_redirects`). location)rPrREDIRECT_STATI)r=r?r?r@ is_redirectszResponse.is_redirectcCsd|jko|jtjtjfkS)z@True if this Response one of the permanent versions of redirect.r)rPrr2Zmoved_permanentlypermanent_redirect)r=r?r?r@is_permanent_redirectszResponse.is_permanent_redirectcCs|jS)zTReturns a PreparedRequest for the next request in a redirect chain, if there is one.)r)r=r?r?r@nextsz Response.nextcCst|jdS)zOThe apparent encoding, provided by the charset_normalizer or chardet libraries.r)r.Zdetectr)r=r?r?r@apparent_encodingszResponse.apparent_encodingr Fcs|fdd}jr(tjtr(tn"dk rJttsJtdttj}|}jrf|n|}|rxt |}|S)aIterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place. chunk_size must be of type int or None. A value of None will function differently depending on the value of `stream`. stream=True will read data as it arrives in whatever size the chunks are received. If stream=False, data is returned as a single chunk. If decode_unicode is True, content will be decoded using the best available encoding based on the response. c 3stjdry$xjjddD] }|Vq WWqtk rZ}z t|Wdd}~XYqtk r}z t|Wdd}~XYqtk r}z t|Wdd}~XYqXnxj }|sP|VqWd_ dS)NstreamT)Zdecode_content) rErrrrrrrrrBr)chunkr) chunk_sizer=r?r@generates    z'Response.iter_content..generateNz.chunk_size must be an int, it is instead a %s.) rrDrboolrintrtyper!r)r=rdecode_unicoderZ reused_chunksZ stream_chunksZchunksr?)rr=r@rs  zResponse.iter_contentNccsd}x|j||dD]r}|dk r(||}|r8||}n|}|rn|drn|rn|dd|dkrn|}nd}x|D] }|VqxWqW|dk r|VdS)zIterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. .. note:: This method is not reentrant safe. N)rr)rsplit splitlinespop)r=rrZ delimiterZpendingrlinesliner?r?r@ iter_liness $  zResponse.iter_linescCsV|jdkrJ|jrtd|jdks,|jdkr4d|_nd|tpFd|_d|_|jS)z"Content of the response, in bytes.Fz2The content for this response was already consumedrNT)rr RuntimeErrorrrr<rCONTENT_CHUNK_SIZE)r=r?r?r@r7s zResponse.contentc Cshd}|j}|jstdS|jdkr(|j}yt|j|dd}Wn&ttfk rbt|jdd}YnX|S)aContent of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``charset_normalizer`` or ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set ``r.encoding`` appropriately before accessing this property. Nr7replace)errors)rrr+r LookupErrorr)r=rrr?r?r@textKs z Response.textcKsh|jsX|jrXt|jdkrXt|j}|dk rXytj|j|f|Stk rVYnXtj|jf|S)a.Returns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises simplejson.JSONDecodeError: If the response body does not contain valid json and simplejson is installed. :raises json.JSONDecodeError: If the response body does not contain valid json and simplejson is not installed on Python 3. :raises ValueError: If the response body does not contain valid json and simplejson is not installed on Python 2. rMN) rrrVr"rloadsrSUnicodeDecodeErrorr)r=kwargsrr?r?r@r1qs  z Response.jsoncCsJ|jd}i}|rFt|}x(|D] }|dp8|d}|||<q"W|S)z8Returns the parsed header links of the response, if any.linkZrelr8)rPrr )r=rllinksrkeyr?r?r@rs   zResponse.linkscCsd}t|jtrDy|jd}WqJtk r@|jd}YqJXn|j}d|jkr`dkrxnnd|j||jf}n,d|jkrdkrnnd|j||jf}|rt||d d S) z+Raises :class:`HTTPError`, if one occurred.r7zutf-8z iso-8859-1iiz%s Client Error: %s for url: %siXz%s Server Error: %s for url: %s)ZresponseN)rDrr,rSrrr8r)r=Zhttp_error_msgrr?r?r@rs zResponse.raise_for_statuscCs0|js|jt|jdd}|dk r,|dS)zReleases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* release_connN)rrrr)r=rr?r?r@rs  zResponse.close)r F)r^r_r`rxrrtrrrrrurrrCrarrrrrrITER_CHUNK_SIZErrrr1rrrr?r?r?r@rRs2 /        7  & r)SrxrsysZencodings.idnaZ encodingsZurllib3.fieldsrZurllib3.filepostrZ urllib3.utilrZurllib3.exceptionsrrrrior rgr Z structuresr rrr rsrrr exceptionsrrrrrrrrZ_internal_utilsrrZutilsrrrrrr r!r"r#r$compatr%r&r'r(r)r*r+r,r-r.r/r0r1rZ status_codesr2ZmovedfoundotherZtemporary_redirectrrZDEFAULT_REDIRECT_LIMITrrrr4rcrnrvrr?r?r?r@sB       (08  rJD