Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/requests_toolbelt/multipart/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyc
�
ӵ Yc@s�dZddlZddlZddlmZddlmZd�Zde	fd��YZ
d	e	fd
��YZd�Zde
fd
��YZde
fd��YZdS(s�

requests_toolbelt.multipart.decoder
===================================

This holds all the implementation details of the MultipartDecoder

i����Ni(tencode_with(tCaseInsensitiveDictcCs+|j|�}|| ||t|�fS(N(tfindtlen(tcontenttboundtpoint((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt_split_on_findst ImproperBodyPartContentExceptioncBseZRS((t__name__t
__module__(((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyRst NonMultipartContentTypeExceptioncBseZRS((R	R
(((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyRscs]tjd}|dkr+|j��}ntjj�j|�j�}�fd�|D�S(Niic3s3|])\}}t|��t|��fVqdS(N(R(t.0tktv(tencoding(sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pys	<genexpr>$s(tsystversion_infotdecodetemailtparsertHeaderParsertparsestrtitems(tstringRtmajortheaders((RsG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt_header_parsers
tBodyPartcBs&eZdZd�Zed��ZRS(s�

    The ``BodyPart`` object is a ``Response``-like interface to an individual
    subpart of a multipart response. It is expected that these will
    generally be created by objects of the ``MultipartDecoder`` class.

    Like ``Response``, there is a ``CaseInsensitiveDict`` object named header,
    ``content`` to access bytes, ``text`` to access unicode, and ``encoding``
    to access the unicode codec.

    cCsy||_i}d|krZt|d�\}|_|dkrft|j�|�}qfntd��t|�|_dS(Ns

ts$content does not contain CR-LF-CR-LF(RRRRtlstripRRR(tselfRRRtfirst((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt__init__6s		cCs|jj|j�S(s'Content of the ``BodyPart`` in unicode.(RRR(R((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyttextDs(R	R
t__doc__R!tpropertyR"(((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyR)s	tMultipartDecodercBsMeZdZdd�Zd�Zed��Zd�Zedd��Z	RS(sg

    The ``MultipartDecoder`` object parses the multipart payload of
    a bytestring into a tuple of ``Response``-like ``BodyPart`` objects.

    The basic usage is::

        import requests
        from requests_toolbelt import MultipartDecoder

        response = request.get(url)
        decoder = MultipartDecoder.from_response(response)
        for part in decoder.parts:
            print(part.header['content-type'])

    If the multipart content is not from a response, basic usage is::

        from requests_toolbelt import MultipartDecoder

        decoder = MultipartDecoder(content, content_type)
        for part in decoder.parts:
            print(part.header['content-type'])

    For both these usages, there is an optional ``encoding`` parameter. This is
    a string, which is the name of the unicode codec to use (default is
    ``'utf-8'``).

    sutf-8cCs?||_||_||_t�|_|j�|j�dS(N(Rtcontent_typeRttupletpartst_find_boundaryt_parse_body(RRR&R((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyR!gs			
cCs�td�|jjd�D��}|d}|jd�ddkr]tdj|���nxZ|dD]N}t|d�\}}|j�d	krht|jd
�|j	�|_
qhqhWdS(Ncss|]}|j�VqdS(N(tstrip(Rtx((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pys	<genexpr>tst;it/t	multiparts*Unexpected mimetype in content-type: '{0}'it=tboundaryt"(R'R&tsplitRtformatRtlowerRR+RR1(Rtct_infotmimetypetitemtattrtvalue((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyR)ss"
cCs,t|�}||| kr$||S|SdS(N(R(tparttboundary_markertbm_len((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt_fix_first_part�scszdjd�jf����fd��d���jjdjd�f��}t��fd�|D���_dS(NRs--cs"tj|��}t|�j�S(N(R%R>RR(R;tfixed(R1R(sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt	body_part�scSs2|dko1|dko1|d dko1|dkS(NRs
is--
s--((R;((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt	test_part�ss
c3s'|]}�|�r�|�VqdS(N((RR,(R@RA(sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pys	<genexpr>�s(tjoinR1RR3R'R((RR(((R@R1RRAsG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyR*�s
	!cCs.|j}|jjdd�}||||�S(Nscontent-type(RRtgettNone(tclstresponseRRR&((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt
from_response�s	(
R	R
R#R!R)tstaticmethodR>R*tclassmethodRG(((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyR%Js		(R#Rtemail.parserRtencoderRtrequests.structuresRRt	ExceptionRRRtobjectRR%(((sG/usr/lib/python2.7/site-packages/requests_toolbelt/multipart/decoder.pyt<module>	s		!

Spamworldpro Mini