Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/botocore/__pycache__/response.cpython-39.pyc
Ðазад
a p�h" � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZmZm Z d dl mZmZ d dl mZ d dlmZ e�e�ZG dd � d e�Zd d� ZdS )� N)�ScalarTypes)�first_non_none_response)�json�set_socket_timeout� XMLParseError)�IncompleteReadError�ReadTimeoutError)r )�parsersc @ 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)�selfZ raw_stream�content_length� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/botocore/response.py�__init__+ s zStreamingBody.__init__c C s8 zt | j|� W n" ty2 tjddd� � Y n0 dS )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 0 s �z StreamingBody.set_socket_timeoutNc C sv z| j �|�}W n2 tyB } zt|j|d��W Y d}~n d}~0 0 | jt|�7 _|du sj|sr|dkrr| �� |S )zhRead at most amt bytes from the stream. If the amt argument is omitted, read all data. )Zendpoint_urlr Nr )r �read�URLLib3ReadTimeoutErrorr �urlr �len�_verify_content_length)r �amt�chunk�er r r r G 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__Y s zStreamingBody.__iter__c C s | � | j�}|r|S t� �dS )z6Return the next 1k chunk from the raw stream. N)r r"