Updated on 2024-03-26 GMT+08:00

Object Upload Overview (SDK for Python)

You can use this API to upload an object to a specified bucket. In OBS, objects are basic data units that you can operate. OBS Python SDK provides many APIs for uploading objects using various methods:

  • Text-based upload: Character strings are used as the data source of an object.
  • Streaming upload: Readable objects that contain the read attribute are used as the data source of an object.
  • File-based upload: Local files are used as the data source of objects.
  • Multipart upload: Large files can be uploaded in multiple parts.
  • Append upload: You can append data to an object.
  • Resumable upload: It is an encapsulated and enhanced version of the multipart upload used for dealing with possible upload failures of large files when the network connection is unstable or a program crashes.
  • Browser-based upload: You can upload objects to a specified bucket in HTML form.

SDK supports the upload of objects whose size ranges from 0 KB to 5 GB. For streaming upload, append upload, and file-based upload, data to be uploaded in a batch cannot be larger than 5 GB. If the file is larger than 5 GB, multipart upload (whose part size is smaller than 5 GB) is suitable. Browser-based upload allows files to be uploaded through a browser.

If you grant anonymous users the read permission for an object during the upload, anonymous users can access the object through a URL after the upload succeeds. The object URL is in the format of https://bucket name.domain name/directory levels/object name. If the object resides in the root directory of a bucket, its URL does not contain a directory level.