asyncio-oss


Nameasyncio-oss JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/Yaocool/async-oss
SummaryAn asynchronous python client SDK for OSS(Aliyun Object Storage Service).
upload_time2024-01-18 15:44:25
maintainer
docs_urlNone
authorOzzy
requires_python
licenseMIT
keywords asyncio-oss async-oss oss
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)
```shell script
$ pip install asyncio-oss
```

## Local compilation
```shell script
$ git clone git@github.com:Yaocool/async-oss.git
$ python setup.py bdist_wheel
$ pip install ./dist/asyncio_oss-*-py3-none-any.whl
```

# Examples
For more examples, please refer to the [test](./asyncio_oss/test) directory.
```python
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())
```

# Discussions Or Issues
Any questions can be raised in `Discussions` or `Issues`, I will answer them from time to time.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Yaocool/async-oss",
    "name": "asyncio-oss",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "asyncio-oss,async-oss,oss",
    "author": "Ozzy",
    "author_email": "ozzycharon@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# An asynchronous python client SDK for OSS(Aliyun Object Storage Service).\nIt has been verified and used in the production environment with QPS \u2248 500  for about half a year, so you can use it with confidence.\n\n# Installation\n## PyPI (recommend)\n```shell script\n$ pip install asyncio-oss\n```\n\n## Local compilation\n```shell script\n$ git clone git@github.com:Yaocool/async-oss.git\n$ python setup.py bdist_wheel\n$ pip install ./dist/asyncio_oss-*-py3-none-any.whl\n```\n\n# Examples\nFor more examples, please refer to the [test](./asyncio_oss/test) directory.\n```python\nimport logging\n\nimport asyncio_oss\nimport asyncio\nimport oss2\n\nOSS_ENDPOINT = 'https://oss-cn-hangzhou.aliyuncs.com'  # definition in https://help.aliyun.com/document_detail/31837.html\nOSS_KEY = '<Your AccessKeyID>'\nOSS_SECRET = '<Your AccessKeySecret>'\nOSS_AUTH = oss2.Auth(OSS_KEY, OSS_SECRET)\nBUCKET_NAME = '<your bucket name>'\nOBJECT_KEY = '<your object key>'\n\n\nasync def main():\n    async with asyncio_oss.Bucket(OSS_AUTH, OSS_ENDPOINT, BUCKET_NAME) as bucket:\n        # Put Object\n        await bucket.put_object(OBJECT_KEY, b'your bytes data')\n\n        # Get Object\n        result = await bucket.get_object(OBJECT_KEY)\n        await result.read()\n        \n        # Head Object\n        head_res = await bucket.head_object(OBJECT_KEY)\n        print(head_res.content_length)\n        \n        # List Objects\n        for obj in (await bucket.list_objects()).object_list:\n            print(obj.key)\n\n        # Delete Object\n        await bucket.delete_object(OBJECT_KEY)\n\n\nif __name__ == '__main__':\n    # open global log\n    log_file_path = \"example_logfile.log\"\n    asyncio_oss.set_file_logger(log_file_path, 'asyncio_oss', logging.DEBUG)\n    loop = asyncio.get_event_loop()\n    loop.run_until_complete(main())\n```\n\n# Discussions Or Issues\nAny questions can be raised in `Discussions` or `Issues`, I will answer them from time to time.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An asynchronous python client SDK for OSS(Aliyun Object Storage Service).",
    "version": "1.1.3",
    "project_urls": {
        "Homepage": "https://github.com/Yaocool/async-oss"
    },
    "split_keywords": [
        "asyncio-oss",
        "async-oss",
        "oss"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84ef469069f23d465f79ad7b49a866091d173502e21a7ba74f9b9aa3079080f5",
                "md5": "09033dc7c8e72f23389057f232cfc306",
                "sha256": "98629512ed6ac40fe15c64cc42ee09a13d94b2e7707a4b84abfd6947197b23e8"
            },
            "downloads": -1,
            "filename": "asyncio_oss-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "09033dc7c8e72f23389057f232cfc306",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 41378,
            "upload_time": "2024-01-18T15:44:25",
            "upload_time_iso_8601": "2024-01-18T15:44:25.707003Z",
            "url": "https://files.pythonhosted.org/packages/84/ef/469069f23d465f79ad7b49a866091d173502e21a7ba74f9b9aa3079080f5/asyncio_oss-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-18 15:44:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Yaocool",
    "github_project": "async-oss",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "asyncio-oss"
}
        
Elapsed time: 0.19637s