-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
194 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,61 @@ | ||
OSS SDK for Python 版本记录 | ||
=========================== | ||
|
||
Python SDK的版本号遵循 `Semantic Versioning <http://semver.org/>`_ 规则。 | ||
|
||
Version 2.1.1 | ||
------------- | ||
|
||
- 修复:issue #28。 | ||
- 修复:正确的设置连接池大小。 | ||
|
||
|
||
Version 2.1.0 | ||
------------- | ||
|
||
- 增加:可以通过 `oss2.defaults.connection_pool_size` 来设置连接池的最大连接数。 | ||
- 增加:可以通过 `oss2.resumable_upload` 函数的 `num_threads` 参数指定并发的线程数,来进行并发上传。 | ||
- 增加:提供断点下载函数 `oss2.resumable_download` 。 | ||
- 修复:保存断点信息的文件名应该由“规则化”的本地文件名生成;当断点信息文件格式不是json时,删除断点信息文件。 | ||
- 修复:修复一些文档的Bug。 | ||
|
||
Version 2.0.6 | ||
------------- | ||
|
||
- 增加:可以通过新增的 `StsAuth` 类,进行STS临时授权 | ||
- 增加:加入Travis CI的支持 | ||
- 改变:对unit test进行了初步的梳理; | ||
|
||
Version 2.0.5 | ||
------------- | ||
|
||
- 改变:缺省的connect timeout由10秒改为60秒。为了兼容老的requests库(版本低于2.4.0),目前connect timeout和read timeout是同一个值,为了避免 | ||
CopyObject、UploadPartCopy因read timeout超时,故把这个超时时间设长。 | ||
- 增加:把 `security-token` 加入到子资源中,参与签名。 | ||
- 修复:用户可以通过设置oss2.defaults里的变量值,直接修改缺省参数 | ||
|
||
Version 2.0.4 | ||
------------- | ||
|
||
- 改变:增加了unittest目录,原先的tests作为functional test;Tox默认是跑unittest | ||
- 修复:按照依赖明确排除requests 2.9.0。因为 `Issue 2844 <https://github.com/kennethreitz/requests/issues/2844>`_ 导致不能传输UTF-8数据。 | ||
- 修复:Object名以'/'开头时,oss server应该报InvalidObjectName,而不是报SignatureDoesNotMatch。原因是URL中对'/'也要做URL编码。 | ||
- 修复:MANIFEST.in中改正README.rst等 | ||
|
||
|
||
|
||
Version 2.0.3 | ||
------------- | ||
|
||
- 重新设计Python SDK,不再基于原有的官方0.x.x版本开发。 | ||
- 只支持Python2.6及以上版本,支持Python 3。 | ||
- 基于requests库 | ||
OSS SDK for Python 版本记录 | ||
=========================== | ||
|
||
Python SDK的版本号遵循 `Semantic Versioning <http://semver.org/>`_ 规则。 | ||
|
||
Version 2.2.0 | ||
------------- | ||
|
||
- 依赖:增加新的依赖: `crcmod` | ||
- 增加:上传、下载增加了CRC64校验,缺省打开 | ||
- 增加:`RTMP` 直播推流相关接口 | ||
- 增加:`bucket.get_object_meta()` 接口,用来更为快速的获取文件基本信息 | ||
- 修复:`bucket.object_exists()` 接口采用 `bucket.get_object_meta()` 来实现,避免因镜像回源造成的 issue #39 | ||
|
||
Version 2.1.1 | ||
------------- | ||
|
||
- 修复:issue #28。 | ||
- 修复:正确的设置连接池大小。 | ||
|
||
|
||
Version 2.1.0 | ||
------------- | ||
|
||
- 增加:可以通过 `oss2.defaults.connection_pool_size` 来设置连接池的最大连接数。 | ||
- 增加:可以通过 `oss2.resumable_upload` 函数的 `num_threads` 参数指定并发的线程数,来进行并发上传。 | ||
- 增加:提供断点下载函数 `oss2.resumable_download` 。 | ||
- 修复:保存断点信息的文件名应该由“规则化”的本地文件名生成;当断点信息文件格式不是json时,删除断点信息文件。 | ||
- 修复:修复一些文档的Bug。 | ||
|
||
Version 2.0.6 | ||
------------- | ||
|
||
- 增加:可以通过新增的 `StsAuth` 类,进行STS临时授权 | ||
- 增加:加入Travis CI的支持 | ||
- 改变:对unit test进行了初步的梳理; | ||
|
||
Version 2.0.5 | ||
------------- | ||
|
||
- 改变:缺省的connect timeout由10秒改为60秒。为了兼容老的requests库(版本低于2.4.0),目前connect timeout和read timeout是同一个值,为了避免 | ||
CopyObject、UploadPartCopy因read timeout超时,故把这个超时时间设长。 | ||
- 增加:把 `security-token` 加入到子资源中,参与签名。 | ||
- 修复:用户可以通过设置oss2.defaults里的变量值,直接修改缺省参数 | ||
|
||
Version 2.0.4 | ||
------------- | ||
|
||
- 改变:增加了unittest目录,原先的tests作为functional test;Tox默认是跑unittest | ||
- 修复:按照依赖明确排除requests 2.9.0。因为 `Issue 2844 <https://github.com/kennethreitz/requests/issues/2844>`_ 导致不能传输UTF-8数据。 | ||
- 修复:Object名以'/'开头时,oss server应该报InvalidObjectName,而不是报SignatureDoesNotMatch。原因是URL中对'/'也要做URL编码。 | ||
- 修复:MANIFEST.in中改正README.rst等 | ||
|
||
|
||
|
||
Version 2.0.3 | ||
------------- | ||
|
||
- 重新设计Python SDK,不再基于原有的官方0.x.x版本开发。 | ||
- 只支持Python2.6及以上版本,支持Python 3。 | ||
- 基于requests库 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,132 @@ | ||
Aliyun OSS SDK for Python | ||
========================== | ||
|
||
.. image:: https://badge.fury.io/py/oss2.svg | ||
:target: https://badge.fury.io/py/oss2 | ||
.. image:: https://travis-ci.org/aliyun/aliyun-oss-python-sdk.svg?branch=master | ||
:target: https://travis-ci.org/aliyun/aliyun-oss-python-sdk | ||
.. image:: https://coveralls.io/repos/github/aliyun/aliyun-oss-python-sdk/badge.svg?branch=master | ||
:target: https://coveralls.io/github/aliyun/aliyun-oss-python-sdk?branch=master | ||
|
||
概述 | ||
---- | ||
|
||
阿里云对象存储Python SDK 2.x版本。该版本不和上一个版本(0.x版本)兼容,包的名称为oss2,以避免和先前的版本冲突。 | ||
|
||
|
||
该版本的SDK依赖于第三方HTTP库 `requests <https://github.com/kennethreitz/requests>`_ ,请按照下述安装方法进行安装。 | ||
|
||
.. note:: | ||
|
||
该版本不包含osscmd命令行工具 | ||
|
||
运行环境 | ||
-------- | ||
|
||
Python 2.6,2.7,3.3,3.4,3.5 | ||
|
||
.. note:: | ||
|
||
请不要使用Python 3.3.0、3.3.1,参考 `Python Issue 16658 <https://bugs.python.org/issue16658>`_ | ||
|
||
安装方法 | ||
-------- | ||
|
||
通过pip安装官方发布的版本(以Linux系统为例): | ||
|
||
.. code-block:: bash | ||
$ pip install oss2 | ||
也可以直接安装解压后的安装包: | ||
|
||
.. code-block:: bash | ||
$ sudo python setup.py install | ||
快速使用 | ||
-------- | ||
|
||
.. code-block:: python | ||
# -*- coding: utf-8 -*- | ||
import oss2 | ||
endpoint = 'http://oss-cn-hangzhou.aliyuncs.com' # 假设你的Bucket处于杭州区域 | ||
auth = oss2.Auth('<你的AccessKeyId>', '<你的AccessKeySecret>') | ||
bucket = oss2.Bucket(auth, endpoint, '<你的Bucket名>') | ||
# Bucket中的文件名(key)为story.txt | ||
key = 'story.txt' | ||
# 上传 | ||
bucket.put_object(key, 'Ali Baba is a happy youth.') | ||
# 下载 | ||
bucket.get_object(key).read() | ||
# 删除 | ||
bucket.delete_object(key) | ||
# 遍历Bucket里所有文件 | ||
for object_info in oss2.ObjectIterator(bucket): | ||
print(object_info.key) | ||
更多例子请参考examples目录下的代码。 | ||
|
||
出错处理 | ||
-------- | ||
|
||
除非特别说明,一旦出错,Python SDK的接口就会抛出异常(见oss2.exceptions子模块)。参考下面的例子: | ||
|
||
.. code-block:: python | ||
try: | ||
result = bucket.get_object(key) | ||
print(result.read()) | ||
except oss2.exceptions.NoSuchKey as e: | ||
print('{0} not found: http_status={1}, request_id={2}'.format(key, e.status, e.request_id)) | ||
测试 | ||
---- | ||
|
||
首先通过环境变量来设置测试所需的AccessKeyId、AccessKeySecret、Endpoint以及Bucket信息(**请不要使用生产环境的Bucket**)。 | ||
以Linux系统为例: | ||
|
||
.. code-block:: bash | ||
$ export OSS_TEST_ACCESS_KEY_ID=<AccessKeyId> | ||
$ export OSS_TEST_ACCESS_KEY_SECRET=<AccessKeySecret> | ||
$ export OSS_TEST_ENDPOINT=<endpoint> | ||
$ export OSS_TEST_BUCKET=<bucket> | ||
$ export OSS_TEST_STS_ID=<AccessKeyId for testing STS> | ||
$ export OSS_TEST_STS_KEY=<AccessKeySecret for testing STS> | ||
$ export OSS_TEST_STS_ARN=<Role ARN for testing STS> | ||
然后通过以下方式运行测试: | ||
|
||
.. code-block:: bash | ||
$ nosetests # 请先安装nose | ||
更多使用 | ||
-------- | ||
- `更多例子 <https://github.com/aliyun/aliyun-oss-python-sdk/tree/master/examples>`_ | ||
- `Python SDK API文档 <http://aliyun-oss-python-sdk.readthedocs.org/en/latest>`_ | ||
- `官网Python SDK文档 <https://docs.aliyun.com/#/pub/oss/sdk/python-sdk&preface>`_ | ||
|
||
联系我们 | ||
-------- | ||
- `阿里云OSS官方网站 <http://oss.aliyun.com>`_ | ||
- `阿里云OSS官方论坛 <http://bbs.aliyun.com>`_ | ||
- `阿里云OSS官方文档中心 <http://www.aliyun.com/product/oss#Docs>`_ | ||
- 阿里云官方技术支持:`提交工单 <https://workorder.console.aliyun.com/#/ticket/createIndex>`_ | ||
|
||
代码许可 | ||
-------- | ||
MIT许可证,参见LICENSE文件。 | ||
Aliyun OSS SDK for Python | ||
========================== | ||
|
||
.. image:: https://badge.fury.io/py/oss2.svg | ||
:target: https://badge.fury.io/py/oss2 | ||
.. image:: https://travis-ci.org/aliyun/aliyun-oss-python-sdk.svg?branch=master | ||
:target: https://travis-ci.org/aliyun/aliyun-oss-python-sdk | ||
.. image:: https://coveralls.io/repos/github/aliyun/aliyun-oss-python-sdk/badge.svg?branch=master | ||
:target: https://coveralls.io/github/aliyun/aliyun-oss-python-sdk?branch=master | ||
|
||
概述 | ||
---- | ||
|
||
阿里云对象存储Python SDK 2.x版本。该版本不和上一个版本(0.x版本)兼容,包的名称为oss2,以避免和先前的版本冲突。 | ||
|
||
|
||
该版本的SDK依赖于第三方HTTP库 `requests <https://github.com/kennethreitz/requests>`_ 以及 `crcmod`。 请按照下述安装方法进行安装。 | ||
|
||
.. note:: | ||
|
||
该版本不包含 `osscmd` 命令行工具 | ||
|
||
运行环境 | ||
-------- | ||
|
||
Python 2.6,2.7,3.3,3.4,3.5 | ||
|
||
.. note:: | ||
|
||
请不要使用Python 3.3.0、3.3.1,参考 `Python Issue 16658 <https://bugs.python.org/issue16658>`_ | ||
|
||
安装方法 | ||
-------- | ||
|
||
通过pip安装官方发布的版本(以Linux系统为例): | ||
|
||
.. code-block:: bash | ||
$ pip install oss2 | ||
也可以直接安装解压后的安装包: | ||
|
||
.. code-block:: bash | ||
$ sudo python setup.py install | ||
快速使用 | ||
-------- | ||
|
||
.. code-block:: python | ||
# -*- coding: utf-8 -*- | ||
import oss2 | ||
endpoint = 'http://oss-cn-hangzhou.aliyuncs.com' # 假设你的Bucket处于杭州区域 | ||
auth = oss2.Auth('<你的AccessKeyId>', '<你的AccessKeySecret>') | ||
bucket = oss2.Bucket(auth, endpoint, '<你的Bucket名>') | ||
# Bucket中的文件名(key)为story.txt | ||
key = 'story.txt' | ||
# 上传 | ||
bucket.put_object(key, 'Ali Baba is a happy youth.') | ||
# 下载 | ||
bucket.get_object(key).read() | ||
# 删除 | ||
bucket.delete_object(key) | ||
# 遍历Bucket里所有文件 | ||
for object_info in oss2.ObjectIterator(bucket): | ||
print(object_info.key) | ||
更多例子请参考examples目录下的代码。 | ||
|
||
出错处理 | ||
-------- | ||
|
||
除非特别说明,一旦出错,Python SDK的接口就会抛出异常(见oss2.exceptions子模块)。参考下面的例子: | ||
|
||
.. code-block:: python | ||
try: | ||
result = bucket.get_object(key) | ||
print(result.read()) | ||
except oss2.exceptions.NoSuchKey as e: | ||
print('{0} not found: http_status={1}, request_id={2}'.format(key, e.status, e.request_id)) | ||
测试 | ||
---- | ||
|
||
首先通过环境变量来设置测试所需的AccessKeyId、AccessKeySecret、Endpoint以及Bucket信息(**请不要使用生产环境的Bucket**)。 | ||
以Linux系统为例: | ||
|
||
.. code-block:: bash | ||
$ export OSS_TEST_ACCESS_KEY_ID=<AccessKeyId> | ||
$ export OSS_TEST_ACCESS_KEY_SECRET=<AccessKeySecret> | ||
$ export OSS_TEST_ENDPOINT=<endpoint> | ||
$ export OSS_TEST_BUCKET=<bucket> | ||
$ export OSS_TEST_STS_ID=<AccessKeyId for testing STS> | ||
$ export OSS_TEST_STS_KEY=<AccessKeySecret for testing STS> | ||
$ export OSS_TEST_STS_ARN=<Role ARN for testing STS> | ||
然后通过以下方式运行测试: | ||
|
||
.. code-block:: bash | ||
$ nosetests # 请先安装nose | ||
更多使用 | ||
-------- | ||
- `更多例子 <https://github.com/aliyun/aliyun-oss-python-sdk/tree/master/examples>`_ | ||
- `Python SDK API文档 <http://aliyun-oss-python-sdk.readthedocs.org/en/latest>`_ | ||
- `官网Python SDK文档 <https://docs.aliyun.com/#/pub/oss/sdk/python-sdk&preface>`_ | ||
|
||
联系我们 | ||
-------- | ||
- `阿里云OSS官方网站 <http://oss.aliyun.com>`_ | ||
- `阿里云OSS官方论坛 <http://bbs.aliyun.com>`_ | ||
- `阿里云OSS官方文档中心 <http://www.aliyun.com/product/oss#Docs>`_ | ||
- 阿里云官方技术支持:`提交工单 <https://workorder.console.aliyun.com/#/ticket/createIndex>`_ | ||
|
||
代码许可 | ||
-------- | ||
MIT许可证,参见LICENSE文件。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = '2.1.1' | ||
__version__ = '2.2.0' | ||
|
||
from . import models, exceptions | ||
|
||
|