All Products
Search
Document Center

:Download objects using Python

Last Updated:May 09, 2025

The Python SDK V2 provides multiple interfaces for object downloads, enabling you to choose the most appropriate one for your scenario.

Type

Interface name

Description

Simple download

client.get_object

  • Streaming download, response body is of StreamBody type

  • Do not directly support CRC-64

  • Do not directly support the progress bar feature

  • Do not support reconnection for failed connections during streaming read

client.get_object_to_file

  • Download objects as local files

  • Download by using a single connection

  • Support CRC-64 (enabled by default)

  • Support the progress bar feature

  • Support reconnection for failed connections

Range download

client.get_object

  • Download a specific range of data

Read-only class file

ReadOnlyFile

ReadOnlyFile.read

ReadOnlyFile.seek

ReadOnlyFile.close

  • File-Like interface, providing read, seek, and close interfaces

  • Provide the Seek capability

  • Support single stream mode (default)

  • Support the asynchronous prefetch mode to improve the read speed

  • Specify the prefetch of blocks and the number of prefetch chunks

  • Do not directly support CRC-64

  • Do not directly support the progress bar feature

  • Support reconnection for failed connections

Download using presigned URL

client.presign

  • Generate a signed URL that allows HTTP GET requests and has a validity period to authorize users to download an object

File download manager

Downloader.download_file

  • Download objects as local files by performing multipart download

  • Specify the size of parts and number of parts that can be downloaded in parallel

  • Support CRC-64 (enabled by default)

  • Support the progress bar feature

  • Support reconnection for failed connections

  • Support breakpoint

  • Write to a temporary file first, then rename it (configurable, enabled by default)