Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3
/
dist-packages
/
botocore
/
__pycache__
/
Filename :
response.cpython-310.pyc
back
Copy
o <&�aE � @ s� d dl Z d dlmZ d dlmZmZmZ d dlmZ d dlm Z d dlmZ d dlm Z d dlmZ d d lmZ e �e�ZG d d� de�Zdd � ZdS )� N)�set_socket_timeout)�IncompleteReadError�ReadTimeoutError�ResponseStreamingError)r )� ProtocolError)�parsers)�ScalarTypes)� XMLParseError)�first_non_none_responsec @ sh e Zd ZdZdZdd� Zdd� Zddd �Zd d� Zdd � Z e Z ddd�Zefdd�Zdd� Z dd� ZdS )� StreamingBodyae Wrapper class for an http response body. This provides a few additional conveniences that do not exist in the urllib3 model: * Set the timeout on the socket (i.e read() timeouts) * Auto validation of content length, if the amount of bytes we read does not match the content length, an exception is raised. � c C s || _ || _d| _d S )Nr )�_raw_stream�_content_length�_amount_read)�self� raw_stream�content_length� r �3/usr/lib/python3/dist-packages/botocore/response.py�__init__0 s zStreamingBody.__init__c C s2 z t | j|� W dS ty tjddd� � w )z&Set the timeout seconds on the socket.zbCannot access the socket object of a streaming response. It's possible the interface has changed.T)�exc_infoN)r r �AttributeError�logger�error)r �timeoutr r r r 5 s ��z StreamingBody.set_socket_timeoutNc C s� z| j �|�}W n# ty } zt|j|d��d}~w ty+ } zt|d��d}~ww | jt|�7 _|du s?|sC|dkrC| � � |S )zhRead at most amt bytes from the stream. If the amt argument is omitted, read all data. )�endpoint_urlr N)r r ) r �read�URLLib3ReadTimeoutErrorr �url�URLLib3ProtocolErrorr r �len�_verify_content_length)r �amt�chunk�er r r r L s � ��zStreamingBody.readc C s | � | j�S )zCReturn an iterator to yield 1k chunks from the raw stream. )�iter_chunks�_DEFAULT_CHUNK_SIZE�r r r r �__iter__` s zStreamingBody.__iter__c C s | � | j�}|r |S t� �)z6Return the next 1k chunk from the raw stream. )r r&