An asynchronous python client SDK for OSS(Aliyun Object Storage Service).
Project description
An asynchronous python client SDK for OSS(Aliyun Object Storage Service).
It has been verified and used in the production environment with QPS ≈ 500 for about half a year, so you can use it with confidence.
Installation
PyPI (recommend)
$ pip install asyncio-oss
Local compilation
$ git clone git@github.com:Yaocool/async-oss.git
$ python setup.py bdist_wheel
$ pip install ./dist/asyncio_oss-1.1.1-py3-none-any.whl
Examples
For more examples, please refer to the test directory.
import logging
import asyncio_oss
import asyncio
import oss2
OSS_ENDPOINT = 'https://oss-cn-hangzhou.aliyuncs.com' # definition in https://help.aliyun.com/document_detail/31837.html
OSS_KEY = '<Your AccessKeyID>'
OSS_SECRET = '<Your AccessKeySecret>'
OSS_AUTH = oss2.Auth(OSS_KEY, OSS_SECRET)
BUCKET_NAME = '<your bucket name>'
OBJECT_KEY = '<your object key>'
async def main():
async with asyncio_oss.Bucket(OSS_AUTH, OSS_ENDPOINT, BUCKET_NAME) as bucket:
# Put Object
await bucket.put_object(OBJECT_KEY, b'your bytes data')
# Get Object
result = await bucket.get_object(OBJECT_KEY)
await result.read()
# Head Object
head_res = await bucket.head_object(OBJECT_KEY)
print(head_res.content_length)
# List Objects
for obj in (await bucket.list_objects()).object_list:
print(obj.key)
# Delete Object
await bucket.delete_object(OBJECT_KEY)
if __name__ == '__main__':
# open global log
log_file_path = "example_logfile.log"
asyncio_oss.set_file_logger(log_file_path, 'asyncio_oss', logging.DEBUG)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
ChangeLogs
-
[Jul 29, 2022 - 1.0.0]
- fix
http.py/do_request
method stream read bug
- fix
-
[May 29, 2023]
- add test cases and supported
asyncio-oss
package in PyPI
- add test cases and supported
-
[May 30, 2023 - 1.0.1]
- bump version to 1.0.1 for PyPI package description updating
-
[June 24, 2023 - 1.0.2]
- remove unused fields add params in
asyncio_oss/http.py api.py
files - fix
asyncio_oss/iterators.py/_BaseIterator/__aiter__
method bug - add
list_buckets
test case intests/service_test.py
forService
class - bump version to 1.0.2
- remove unused fields add params in
-
[June 27, 2023 - 1.1.0]
- remove unused objects and methods in
asyncio_oss/models.py
andasyncio_oss/utils.py
to streamline sdk package - support oss2==2.18.0 newest apis
- support global log
- bump version to 1.1.0
- remove unused objects and methods in
-
[June 28, 2023 - 1.1.1]
- fix the bug of wrong signature of
put_object_tagging
interface caused by defaultContent-Type
of aiohttp - bump version to 1.1.1
- fix the bug of wrong signature of
Discussions Or Issues
Any questions can be raised in Discussions
or Issues
, I will answer them from time to time.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncio-oss-1.1.1.tar.gz
(41.7 kB
view hashes)
Built Distribution
Close
Hashes for asyncio_oss-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c7b20b63ab9a09f3a5cea5d1d2553a1797bb7f4ea0c79296ebefbd2edb9559f |
|
MD5 | c1d3e7b34560af89e52e4609af90a97d |
|
BLAKE2b-256 | 244aaa424baf25adc81bf252be73e3547bccf9a9b7d1c558a731f90bf0d18ab1 |