Registry / aws / tos
library2.9.2pypypiunverified

The `tos` Python SDK enables developers to interact with Volcengine Object Storage (TOS), allowing for operations on buckets and objects. It provides a programmatic interface for cloud storage functionalities like uploading, downloading, and managing files. The library is actively maintained, with version 2.9.0 released recently, indicating a consistent development cadence.

pip install tos
INSTALL
IMPORT
SIG · TOS
T
tos
awspythonv2.9.2
Install
4.6s avg
Import
757ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.9.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.795s · 27.3MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 4.6s · import 0.719s · 28MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TosClientV2
✓ import tos client = tos.TosClientV2(...)
✗ from tos import TosClient
The primary client class is `TosClientV2`, not `TosClient` from older versions or other SDKs.
TosClientError
✓ from tos.exceptions import TosClientError
Specific exception for client-side errors (e.g., invalid parameters, network issues).
TosServerError
✓ from tos.exceptions import TosServerError
Specific exception for server-side errors (e.g., HTTP status codes from TOS service).

This quickstart demonstrates how to initialize the `TosClientV2` using environment variables for authentication and endpoint configuration. It then performs a basic operation like listing buckets and checking for an object, including essential error handling for both client-side and server-side issues.

import os import tos from tos.exceptions import TosClientError, TosServerError # Ensure environment variables are set for authentication # os.environ['TOS_ACCESS_KEY'] = 'YOUR_ACCESS_KEY' # os.environ['TOS_SECRET_KEY'] = 'YOUR_SECRET_KEY' # os.environ['TOS_ENDPOINT'] = 'http://tos-cn-beijing.volces.com' # Example endpoint # os.environ['TOS_REGION'] = 'cn-beijing' # Example region ak = os.environ.get('TOS_ACCESS_KEY', '') sk = os.environ.get('TOS_SECRET_KEY', '') endpoint = os.environ.get('TOS_ENDPOINT', '') region = os.environ.get('TOS_REGION', '') bucket_name = 'your-example-bucket' object_key = 'your-example-object' client = None try: # Initialize TosClientV2 with credentials and endpoint client = tos.TosClientV2(ak, sk, endpoint, region) # Example: List buckets print(f"Listing buckets for endpoint: {endpoint}") response = client.list_buckets() print("Buckets:") for bucket in response.buckets: print(f"- {bucket.name}") # Example: Check if a specific object exists (simplified for quickstart) try: response = client.head_object(bucket_name, object_key) print(f"Object '{object_key}' exists in bucket '{bucket_name}'.") except TosServerError as e: if e.status == 404: print(f"Object '{object_key}' not found in bucket '{bucket_name}'.") else: raise # Re-raise other server errors except TosClientError as e: print(f"Client-side error: {e}") except TosServerError as e: print(f"Server-side error: Status {e.status}, Code {e.code}, Message: {e.message}") except Exception as e: print(f"An unexpected error occurred: {e}") finally: if client: # Ensure client is closed if it manages connections pass # No explicit close method documented for TosClientV2 in examples, usually handled internally
Debug
Known issues
gotchaThe official PyPI summary and GitHub README consistently refer to the service as 'Tinder Object Storage' instead of 'Volcengine Object Storage'. While functional, this typo can be confusing.
fix
Be aware that 'Tinder Object Storage' refers to Volcengine Object Storage in this context.
affects: All versions
breakingThe SDK relies heavily on correct `ACCESS_KEY`, `SECRET_KEY`, `ENDPOINT`, and `REGION`. Incorrect or missing credentials will lead to `TosClientError` or `TosServerError` depending on the stage of the request.
fix
Ensure `TOS_ACCESS_KEY`, `TOS_SECRET_KEY`, `TOS_ENDPOINT`, and `TOS_REGION` environment variables are correctly set, or pass them directly during `TosClientV2` initialization. Consult your Volcengine account for the correct values.
affects: All versions
gotchaFor optimal performance and stability, initialize `TosClientV2` once and reuse the instance for multiple operations rather than creating a new client for each request.
fix
Store the `TosClientV2` instance in a global variable or pass it around within your application's scope to avoid repeated initialization overhead.
affects: All versions
gotchaThe library differentiates between client-side errors (`TosClientError`) and server-side errors (`TosServerError`). `TosClientError` often indicates invalid request parameters or network issues, while `TosServerError` reflects issues reported by the TOS service itself, including HTTP status codes.
fix
Implement robust `try...except` blocks to catch both `tos.exceptions.TosClientError` and `tos.exceptions.TosServerError` for comprehensive error handling. Check `e.status` and `e.code` for `TosServerError` for specific diagnostics.
affects: All versions
Upgrade
Version history
2.9.2latest on PyPI · released Jun 3, 2026
Audit
Dependencies
Python 3.7+requiredRequired Python version for the SDK functionality.
Agent activity
51 hits · last 30 days
node
48
OpenAI (training)
1
Resources
tos — pip install tos · libregistry