s3#
Defines S3 transport adapter for CondaSession (requests.Session).
Classes#
The Base Transport Adapter |
- class S3Adapter#
Bases:
conda.gateways.connection.BaseAdapterThe Base Transport Adapter
- send(request: conda.gateways.connection.PreparedRequest, stream: bool = False, timeout: None | float | tuple[float, float] | tuple[float, None] = None, verify: bool | str = True, cert: None | bytes | str | tuple[bytes | str, bytes | str] = None, proxies: dict[str, str] | None = None) conda.gateways.connection.Response#
Sends PreparedRequest object. Returns Response object.
- Parameters:
request -- The
PreparedRequestbeing sent.stream -- (optional) Whether to stream the request content.
timeout (float or tuple) -- (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.
verify -- (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use
cert -- (optional) Any user-provided SSL certificate to be trusted.
proxies -- (optional) The proxies dictionary to apply to the request.
- close()#
Cleans up adapter specific items.
- direct_download(url: str, fileobj: IO[bytes], progress_callback: collections.abc.Callable[[float], None] | None = None, size: int | None = None) None#
Download S3 object directly to file object using boto3's optimized download_fileobj, which handles multipart downloads and retries.
This avoids the extra copy that occurs when using send() which buffers to a SpooledTemporaryFile first.
- Parameters:
url -- S3 URL (s3://bucket/key)
fileobj -- File object to write to (must be opened in binary write mode)
progress_callback -- Optional callback(fraction) where fraction is 0.0-1.0
size -- Optional content length (required for progress reporting)
- Raises:
CondaError -- On S3 errors or if boto3 is not installed
- _send_boto3(resp: conda.gateways.connection.Response, request: conda.gateways.connection.PreparedRequest) conda.gateways.connection.Response#
- _write_tempfile(writer_callable)#