asyncio-oss


Nameasyncio-oss JSON
Version 1.1.5 PyPI version JSON
download
home_pagehttps://github.com/Yaocool/async-oss
SummaryAn asynchronous python client SDK for OSS(Aliyun Object Storage Service).
upload_time2024-07-05 16:44:30
maintainerNone
docs_urlNone
authorOzzy
requires_pythonNone
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())
```

# Contributors Wall
<a href=" ">
  <img src="https://contrib.rocks/image?repo=Yaocool/async-oss&max=200" />
</a >



# 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": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "asyncio-oss, async-oss, oss",
    "author": "Ozzy",
    "author_email": "ozzycharon@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/bb/c2ab8d2be09c48815601dce2e5acde79de3c35c59edd5e0fcb33ae5c5a2f/asyncio_oss-1.1.5.tar.gz",
    "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# Contributors Wall\n<a href=\" \">\n  <img src=\"https://contrib.rocks/image?repo=Yaocool/async-oss&max=200\" />\n</a >\n\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.5",
    "project_urls": {
        "Homepage": "https://github.com/Yaocool/async-oss"
    },
    "split_keywords": [
        "asyncio-oss",
        " async-oss",
        " oss"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2bf8a0937118f052b978de42657c9a9da7af209d1f0d91ed8fbce824612293b5",
                "md5": "4108b165a02ee564a482a1ccc322e4b2",
                "sha256": "09eb5a1cfdacc2b834e8df53c56367565e064dee14fcf718c4430b6703d7cccf"
            },
            "downloads": -1,
            "filename": "asyncio_oss-1.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4108b165a02ee564a482a1ccc322e4b2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 41743,
            "upload_time": "2024-07-05T16:44:29",
            "upload_time_iso_8601": "2024-07-05T16:44:29.828246Z",
            "url": "https://files.pythonhosted.org/packages/2b/f8/a0937118f052b978de42657c9a9da7af209d1f0d91ed8fbce824612293b5/asyncio_oss-1.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9bbc2ab8d2be09c48815601dce2e5acde79de3c35c59edd5e0fcb33ae5c5a2f",
                "md5": "8f8f825bfe6148e56d74dd0dc46da0ef",
                "sha256": "2697b7da981fe2dea761f3f69f9daba265113b9c5e1ba487213c4e79ac392b6f"
            },
            "downloads": -1,
            "filename": "asyncio_oss-1.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "8f8f825bfe6148e56d74dd0dc46da0ef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 40195,
            "upload_time": "2024-07-05T16:44:30",
            "upload_time_iso_8601": "2024-07-05T16:44:30.890659Z",
            "url": "https://files.pythonhosted.org/packages/c9/bb/c2ab8d2be09c48815601dce2e5acde79de3c35c59edd5e0fcb33ae5c5a2f/asyncio_oss-1.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-05 16:44:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Yaocool",
    "github_project": "async-oss",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "asyncio-oss"
}
        
Elapsed time: 0.24706s