/aliyun-oss-python-sdk

Aliyun OSS SDK for Python

Primary LanguagePythonMIT LicenseMIT

Alibaba Cloud OSS SDK for Python

image

image

image

README of Chinese <https://github.com/aliyun/aliyun-oss-python-sdk/blob/master/README-CN.rst>

Overview

Alibaba Cloud Object Storage Python SDK 2.x. This version is not compatible with the previous version (Version 0.x). The package name is oss2 to avoid conflict with previous versions.

The SDK of this version is dependent on the third-party HTTP library requests and crcmod. Install the SDK following the methods below.

Note:

This version does not contain the osscmd command line tool.

Running environment

Python 2.6(not recommended),2.7,3.3(not recommended),3.4,3.5,3.6

Note:

Python 2.6 is not recommended because it is no longer supported by the Python core team. Do not use Python 3.3.0 or 3.3.1. Refer to Python Issue 16658.

Installing

Install the official release version through PIP (taking Linux as an example):

You can also install the unzipped installer package directly:

Getting started

For more examples, refer to the code under the "examples" directory.

Handling errors

The Python SDK interface will throw an exception in case of an error (see oss2.exceptions sub-module) unless otherwise specified. An example is provided below:

Setup Logging

The following code can set the logging level of 'oss2'.

Testing

First set the required AccessKeyId, AccessKeySecret, endpoint and bucket information for the test through environment variables (Do not use the bucket for the production environment). Take the Linux system for example:

Run the test in the following method:

You can set environment variable to test auth v2:

More resources

Contacting us

License