ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/requests/__pycache__/models.cpython-36.opt-1.pyc
3

[@sdZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZmZddlmZdd	lmZdd
lmZddlmZddlmZmZmZdd
lmZmZmZm 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.m/Z/m0Z0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>ddl2m?Z@ddlAmBZBeBjCeBjDeBjEeBjFeBjGfZHdZId!ZJdZKGdddeLZMGdddeLZNGdddeNZOGdddeMeNZPGdd d eLZQdS)"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
InvalidURLChunkedEncodingErrorContentDecodingErrorConnectionErrorStreamConsumedError)to_native_stringunicode_is_ascii)
guess_filenameget_auth_from_urlrequote_uristream_decode_response_unicodeto_key_val_listparse_header_linksiter_slicesguess_json_utf	super_lencheck_header_validity)CallableMapping	cookielib
urlunparseurlsplit	urlencodestrbytesis_py2chardetbuiltin_str
basestring)json)codes
iic@s0eZdZeddZeddZeddZdS)RequestEncodingMixincCsNg}t|j}|j}|sd}|j||j}|rD|jd|j|dj|S)zBuild the path URL to use./?)r(urlpathappendqueryjoin)selfr8pr9r;r?/usr/lib/python3.6/models.pypath_url=s



zRequestEncodingMixin.path_urlcCst|ttfr|St|dr |St|drg}x|t|D]p\}}t|tsVt|dr\|g}xJ|D]B}|dk	rb|jt|tr|jdn|t|tr|jdn|fqbWq8Wt|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+hasattrrr/r:encoder))dataresultkZvsvr?r?r@_encode_paramsRs 	


$z#RequestEncodingMixin._encode_paramscCs|stdnt|tr tdg}t|p,i}t|p8i}x|D]\}}t|ts`t|drf|g}x\|D]T}|dk	rlt|tst|}|jt|tr|jdn|t|tr|j	dn|fqlWqBWx|D]\}}d}d}	t|t
tfr.t|dkr|\}
}n&t|dkr |\}
}}n|\}
}}}	nt
|p:|}
|}t|tttfrX|}n(t|drn|j}n|dkr|qn|}t|||
|	d	}
|
j|d
|j|
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)
ValueErrorrDr/rrEr+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|j|n$t|drV|j|jdd|DdS)zProperly register a hook.z1Unsupported event specified, with event name "%s"rCcss|]}t|tr|VqdS)N)rDr$).0hr?r?r@	<genexpr>sz2RequestHooksMixin.register_hook.<locals>.<genexpr>N)hooksrRrDr$r:rEextend)r=eventhookr?r?r@
register_hooks


zRequestHooksMixin.register_hookcCs.y|j|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@rcsrcc
@s*eZdZdZd	ddZddZddZdS)
Requesta{A user-created :class:`Request <Request>` object.

    Used to prepare a :class:`PreparedRequest <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()
      <PreparedRequest [GET]>
    Nc
Cs|dkrgn|}|dkrgn|}|dkr,in|}|dkr<in|}|	dkrLin|	}	t|_x&t|	jD]\}}|j||dqfW||_||_||_||_||_	|
|_
||_||_||_
dS)N)rirj)rrgrUitemsrkmethodr8rPrXrGr0paramsauthcookies)
r=rpr8rPrXrGrqrrrsrgr0rIrJr?r?r@__init__s"zRequest.__init__cCs
d|jS)Nz<Request [%s]>)rp)r=r?r?r@__repr__szRequest.__repr__cCs<t}|j|j|j|j|j|j|j|j|j	|j
|jd
|S)zXConstructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it.)
rpr8rPrXrGr0rqrrrsrg)PreparedRequestpreparerpr8rPrXrGr0rqrrrsrg)r=r>r?r?r@rws
zRequest.prepare)
NNNNNNNNNN)r^r_r`__doc__rtrurwr?r?r?r@rns

rnc
@seZdZdZddZdddZddZd	d
ZddZe	d
dZ
ddZddZdddZ
ddZd ddZddZddZdS)!rvaThe fully mutable :class:`PreparedRequest <PreparedRequest>` object,
    containing the exact bytes that will be sent to the server.

    Generated from either a :class:`Request <Request>` object or manually.

    Usage::

      >>> import requests
      >>> req = requests.Request('GET', 'https://httpbin.org/get')
      >>> r = req.prepare()
      <PreparedRequest [GET]>

      >>> s = requests.Session()
      >>> s.send(r)
      <Response [200]>
    cCs0d|_d|_d|_d|_d|_t|_d|_dS)N)rpr8rP_cookiesr\rrg_body_position)r=r?r?r@rt"szPreparedRequest.__init__NcCsR|j||j|||j||j||j|||
|j|||j|	dS)z6Prepares the entire request with the given parameters.N)prepare_methodprepare_urlprepare_headersprepare_cookiesprepare_bodyprepare_auth
prepare_hooks)r=rpr8rPrXrGrqrrrsrgr0r?r?r@rw3s


zPreparedRequest.preparecCs
d|jS)Nz<PreparedRequest [%s]>)rp)r=r?r?r@ruEszPreparedRequest.__repr__cCsXt}|j|_|j|_|jdk	r*|jjnd|_t|j|_|j|_|j|_|j	|_	|S)N)
rvrpr8rPcopyrryr\rgrz)r=r>r?r?r@rHszPreparedRequest.copycCs$||_|jdk	r t|jj|_dS)zPrepares the given HTTP method.N)rprupper)r=rpr?r?r@r{Ss
zPreparedRequest.prepare_methodcCs@ddl}y|j|ddjd}Wn|jk
r:tYnX|S)NrT)Zuts46zutf-8)idnarFrSZ	IDNAErrorUnicodeError)hostrr?r?r@_get_idna_encoded_hostYs
z&PreparedRequest._get_idna_encoded_hostcCs0t|tr|jd}ntr"t|nt|}|j}d|krT|jjdrT||_	dSyt
|\}}}}}}}	Wn,tk
r}
zt|
j
WYdd}
~
XnX|sd}|jt|d}t||std|t|sy|j|}Wntk
rtdYnXn|jdrtd|p"d	}|r2|d
7}||7}|rP|dt|7}|sZd}trt|trv|jd}t|tr|jd}t|tr|jd}t|tr|jd}t|	tr|	jd}	t|ttfrt|}|j|}
|
r|r
d
||
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=r8rqschemerrrZportr9r;ZfragmenteerrorZnetlocZ
enc_paramsr?r?r@r|csh








zPreparedRequest.prepare_urlcCs@t|_|r<x.|jD]"}t||\}}||jt|<qWdS)z Prepares the given HTTP headers.N)rrPror#r)r=rPheaderrNvaluer?r?r@r}szPreparedRequest.prepare_headerscCstd}d}|r8|dk	r8d}tj|}t|ts8|jd}tt|dt|ttt	t
fg}yt|}Wntt
tfk
rd}YnX|r|}t|dddk	ry|j|_Wn ttfk
rt|_YnX|rtd|rt||jd<n
d|jd	<np|r|j||\}}n2|rD|j|}t|ts:t|d
r@d}nd}|j||rjd|jkrj||jd
<||_dS)z"Prepares the given HTTP body data.Nzapplication/jsonzutf-8rCtellz1Streamed bodies and files are mutually exclusive.zContent-LengthZchunkedzTransfer-EncodingrBz!application/x-www-form-urlencodedzcontent-typezContent-Type)complexjsondumpsrDr+rFallrEr/rUrTr%r"	TypeErrorAttributeErrorr	getattrrrzIOErrorOSErrorobjectNotImplementedErrorr.rPr]rKprepare_content_lengthr\)r=rGrXr0r\rQZ	is_streamlengthr?r?r@rsJ






zPreparedRequest.prepare_bodycCsL|dk	r$t|}|rHt||jd<n$|jdkrH|jjddkrHd|jd<dS)z>Prepare Content-Length header based on request method and bodyNzContent-LengthGETHEAD0)rr)r"r.rPrpget)r=r\rr?r?r@r	sz&PreparedRequest.prepare_content_lengthr7cCsj|dkr"t|j}t|r|nd}|rft|trDt|dkrDt|}||}|jj|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 <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~,s
zPreparedRequest.prepare_cookiescCs*|pg}x|D]}|j|||qWdS)zPrepares the given hooks.N)rk)r=rgrir?r?r@r@s
zPreparedRequest.prepare_hooks)
NNNNNNNNNN)N)r7)r^r_r`rxrtrwrurr{rbrr|r}rrrr~rr?r?r?r@rvs

V
E
rvc
@seZdZdZdddddddd	d
dg
Zdd
ZddZddZddZddZ	ddZ
ddZddZddZ
eddZed d!Zed"d#Zed$d%Zed&d'Zd;d*d+Zed,d,fd-d.Zed/d0Zed1d2Zd3d4Zed5d6Zd7d8Zd9d:Zd,S)<ResponsezhThe :class:`Response <Response>` object, which contains a
    server's response to an HTTP request.
    _contentstatus_coderPr8historyencodingreasonrselapsedrequestcCs^d|_d|_d|_d|_t|_d|_d|_d|_g|_	d|_
ti|_t
jd|_d|_dS)NFr)r_content_consumed_nextrrrPrawr8rrrrrsdatetimeZ	timedeltarr)r=r?r?r@rtTs
zResponse.__init__cCs|S)Nr?)r=r?r?r@	__enter__szResponse.__enter__cGs|jdS)N)close)r=rr?r?r@__exit__szResponse.__exit__cs jsjfddjDS)Ncsi|]}t|d|qS)N)r)rdattr)r=r?r@
<dictcomp>sz)Response.__getstate__.<locals>.<dictcomp>)rcontent	__attrs__)r=r?)r=r@__getstate__szResponse.__getstate__cCs>x |jD]\}}t|||q
Wt|ddt|dddS)NrTr)rosetattr)r=staterNrr?r?r@__setstate__szResponse.__setstate__cCs
d|jS)Nz<Response [%s]>)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
|jdS)z,Allows you to use a response as an iterator.)iter_content)r=r?r?r@rCszResponse.__iter__cCs&y|jWntk
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
	zResponse.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)rPrr1Zmoved_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.nextcCstj|jdS)z7The apparent encoding, provided by the chardet library.r)r-Zdetectr)r=r?r?r@apparent_encodingszResponse.apparent_encodingr
Fcs~fdd}jr(tjtr(tn$dk	rLttrLtdttj}|}jrh|n|}|rzt	|}|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.
        c3stjdry$xjjddD]
}|Vq WWqtk
rZ}zt|WYdd}~Xqtk
r}zt|WYdd}~Xqtk
r}zt|WYdd}~XqXnxjj	}|sP|VqWd_
dS)NstreamT)Zdecode_content)rErrrrrrrrrBr)chunkr)
chunk_sizer=r?r@generates 
z'Response.iter_content.<locals>.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|j|}n|j}|rn|drn|rn|dd|dkrn|j}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)rrr
rrr)rsplit
splitlinespop)r=rrZ	delimiterpendingrlinesliner?r?r@
iter_liness$

zResponse.iter_linescCsV|jdkrJ|jrtd|jdks,|jdkr4d|_ndj|jtpFd|_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@r/s
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
        ``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*rLookupErrorr)r=rrr?r?r@textCs
z
Response.textcKsj|jrZ|jrZt|jdkrZt|j}|dk	rZytj|jj|f|Stk
rXYnXtj|jf|S)zReturns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises ValueError: If the response body does not contain valid json.
        rMN)	rrrVr!rloadsrSUnicodeDecodeErrorr)r=kwargsrr?r?r@r0is
z
Response.jsoncCsJ|jjd}i}|rFt|}x(|D] }|jdp8|jd}|||<q"W|S)z8Returns the parsed header links of the response, if any.linkZrelr8)rPrr)r=rllinksrkeyr?r?r@rs
zResponse.linkscCsd}t|jtrDy|jjd}WqJtk
r@|jjd}YqJXn|j}d|jko^dknrxd|j||jf}n,d|jkodknrd|j||jf}|rt||d	d
S)z2Raises stored :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|jjt|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_SIZErrrr0rrrr?r?r?r@rJs2
/


7&ri()RrxrsysZencodings.idnaZ	encodingsZurllib3.fieldsrZurllib3.filepostrZurllib3.utilrZurllib3.exceptionsrrrrior	rgrZ
structuresrrrr
rsrrr
exceptionsrrrrrrrZ_internal_utilsrrZutilsrrrrrrr r!r"r#compatr$r%r&r'r(r)r*r+r,r-r.r/r0rZstatus_codesr1ZmovedfoundotherZtemporary_redirectrrZDEFAULT_REDIRECT_LIMITrrrr4rcrnrvrr?r?r?r@<module>sB$08rJ<