HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/__pycache__/requests_file.cpython-37.pyc
B

��f��@s�ddlmZddlmZmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZyddlm
Z
Wn ek
r�ddlmZ
YnXGdd�de�ZdS)	�)�BaseAdapter)�urlparse�unquote)�Response�codesN)�BytesIO)�StringIOcs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�FileAdapterTcstt|���||_dS)N)�superr	�__init__�_set_content_length)�selfZset_content_length)�	__class__��>/opt/alt/python37/lib/python3.7/site-packages/requests_file.pyrszFileAdapter.__init__c
KsR|jdkrtd|j��t|j�}|jr:|jdkr:td��t�}||_�y&dd�|j�d�D�}x|rz|dsz|�	d�qbWt
d	d
�|D��r�ttj
t�tj
���|�r|d�d�s�|d�d��r|�	d�}|�d�r�|d
d�d}x$|�r|d�s|�	d�q�Wnd}|tjtjj|�}|�rRtj�|��sRtjtjj|f|��}t�|d�|_|jj|j_Wn�tk
�r
}z||jtjk�r�tj|_n |jtj
k�r�tj|_ntj|_t|�� t!�"d��}	t#|	�|_|j$�r�t%|	�|j&d<|jj|j_Wd
d
}~XYnDXtj'|_|j|_t�(|j�)��}
t*�+|
j,��rN|j$�rN|
j-|j&d<|S)z�Wraps a file, described in request, in a Response object.

        :param request: The PreparedRequest` being "sent".
        :returns: a Response object containing the file
        )�GET�HEADzInvalid request method %s�	localhostz5file: URLs with hostname components are not permittedcSsg|]}t|��qSr)r)�.0�prrr�
<listcomp>0sz$FileAdapter.send.<locals>.<listcomp>�/rcss|]}tj|kVqdS)N)�os�sep)rrrrr�	<genexpr>8sz#FileAdapter.send.<locals>.<genexpr>�|�:N�����rbFzContent-Length).�method�
ValueErrorr�url�netlocr�request�path�split�pop�any�IOError�errno�ENOENTr�strerror�endswithr�join�
splitdrive�io�open�raw�close�release_conn�EACCESr�	forbidden�status_code�	not_found�bad_request�str�encode�locale�getpreferredencodingrr�len�headers�ok�fstat�fileno�stat�S_ISREG�st_mode�st_size)r
r$�kwargsZ	url_parts�resp�
path_parts�
path_driver%�eZresp_strZ	resp_statrrr�sendsV






zFileAdapter.sendcCsdS)Nr)r
rrrr3xszFileAdapter.close)T)�__name__�
__module__�__qualname__rrLr3�
__classcell__rr)rrr	scr	)Zrequests.adaptersrZrequests.compatrr�requestsrrr*rrCr<r0r�ImportErrorrr	rrrr�<module>s