aliyun/aliyun-oss-python-sdk — 996★ trên GitHub (Python). Aliyun OSS SDK for Python
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
README of Chinese <https://github.com/aliyun/aliyun-oss-python-sdk/blob/master/README-CN.rst>_
About OSS SDK for Python V2
OSS SDK for Python V2 alibabacloud-oss-python-sdk-v2 <https://github.com/aliyun/alibabacloud-oss-python-sdk-v2>_ beta version has been released, it is a major rewrite of OSS SDK for Python V1 (aliyun-oss-python-sdk).
V2 simplifies underlying operations such as identification authentication, automatic retry of failed requests, and error handling. It provides flexible parameter configuration methods and rich advanced operations, such as paginator, transmission managers, and File-like operations. This comprehensively improves development efficiency and experience.
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 <https://github.com/kennethreitz/requests>_ and crcmod. Install the SDK following the methods below.
Note:
This version does not contain the `osscmd` command line tool.
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 <https://bugs.python.org/issue16658>_.
Installing
Install the official release version through PIP (taking Linux as an example):
.. code-block:: bash
$ pip install oss2
You can also install the unzipped installer package directly:
.. code-block:: bash
$ sudo python setup.py install
Getting started
.. code-block:: python
# -*- coding: utf-8 -*-
import oss2
endpoint = 'http://oss-cn-hangzhou.aliyuncs.com' # Suppose that your bucket is in the Hangzhou region.
auth = oss2.Auth('<Your AccessKeyID>', '<Your AccessKeySecret>')
bucket = oss2.Bucket(auth, endpoint, '<your bucket name>')
# The object key in the bucket is story.txt
key = 'story.txt'
# Upload
bucket.put_object(key, 'Ali Baba is a happy youth.')
# Download
bucket.get_object(key).read()
# Delete
bucket.delete_object(key)
# Traverse all objects in the bucket
for object_info in oss2.ObjectIterator(bucket):
print(object_info.key)
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:
.. 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))
Setup Logging
The following code can set the logging level of 'oss2'.
.. code-block:: python
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:
aliyun/aliyun-oss-python-sdk có 996 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/aliyun/aliyun-oss-python-sdk. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
aliyun/aliyun-oss-python-sdk có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho aliyun/aliyun-oss-python-sdk. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
aliyun/aliyun-oss-python-sdk còn đang phát triển không?
Commit gần nhất trên aliyun/aliyun-oss-python-sdk là 1.6 năm trước (theo timestamp GitHub). Repo có 355 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
aliyun/aliyun-oss-python-sdk viết bằng ngôn ngữ gì?
aliyun/aliyun-oss-python-sdk chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc thêm về aliyun/aliyun-oss-python-sdk ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/aliyun/aliyun-oss-python-sdk là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về aliyun-oss-python-sdk?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về aliyun-oss-python-sdk.