Được TopGit lập chỉ mục từ metadata GitHub: aio-libs/aiobotocore có 1.4k sao, viết chủ yếu bằng Python. asyncio support for botocore library using aiohttp
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.
Async client for amazon services using botocore_ and aiohttp_/asyncio_.
This library is a mostly full featured asynchronous version of botocore.
Install
::
$ pip install aiobotocore
Basic Example
.. code:: python
import asyncio
from aiobotocore.session import get_session
AWS_ACCESS_KEY_ID = "xxx"
AWS_SECRET_ACCESS_KEY = "xxx"
async def go():
bucket = 'dataintake'
filename = 'dummy.bin'
folder = 'aiobotocore'
key = '{}/{}'.format(folder, filename)
session = get_session()
async with session.create_client('s3', region_name='us-west-2',
aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
aws_access_key_id=AWS_ACCESS_KEY_ID) as client:
# upload object to amazon s3
data = b'\x01'*1024
resp = await client.put_object(Bucket=bucket,
Key=key,
Body=data)
print(resp)
# getting s3 object properties of file we just uploaded
resp = await client.get_object_acl(Bucket=bucket, Key=key)
print(resp)
# get object from s3
response = await client.get_object(Bucket=bucket, Key=key)
# this will ensure the connection is correctly re-used/closed
async with response['Body'] as stream:
assert await stream.read() == data
# list s3 objects using paginator
paginator = client.get_paginator('list_objects_v2')
async for result in paginator.paginate(Bucket=bucket, Prefix=folder):
for c in result.get('Contents', []):
print(c)
# delete object from s3
resp = await client.delete_object(Bucket=bucket, Key=key)
print(resp)
loop = asyncio.get_event_loop()
loop.run_until_complete(go())
Context Manager Examples
.. code:: python
from contextlib import AsyncExitStack
from aiobotocore.session import AioSession
# How to use in existing context manager
class Manager:
def __init__(self):
self._exit_stack = AsyncExitStack()
self._s3_client = None
async def __aenter__(self):
session = AioSession()
self._s3_client = await self._exit_stack.enter_async_context(session.create_client('s3'))
async def __aexit__(self, exc_type, exc_val, exc_tb):
await self._exit_stack.__aexit__(exc_type, exc_val, exc_tb)
# How to use with an external exit_stack
async def create_s3_client(session: AioSession, exit_stack: AsyncExitStack):
# Create client and add cleanup
client = await exit_stack.enter_async_context(session.create_client('s3'))
return client
async def non_manager_example():
session = AioSession()
async with AsyncExitStack() as exit_stack:
s3_client = await create_s3_client(session, exit_stack)
# do work with s3_client
Supported AWS Services
This is a non-exuastive list of what tests aiobotocore runs against AWS services. Not all methods are tested but we aim to test the majority of
commonly used methods.
Due to the way boto3 is implemented, its highly likely that even if services are not listed above that you can take any boto3.client('service') and
stick await in front of methods to make them async, e.g. await client.list_named_queries() would asynchronous list all of the named Athena queries.
If a service is not listed here and you could do with some tests or examples feel free to raise an issue.
Enable type checking and code completion
Install types-aiobotocore_ that contains type annotations for aiobotocore
and all supported botocore_ services.
.. code:: bash
# install aiobotocore type annotations
# for ec2, s3, rds, lambda, sqs, dynamo and cloudformation
python -m pip install 'types-aiobotocore[essential]'
# or install annotations for services you use
python -m pip install 'types-aiobotocore[acm,apigateway]'
# Lite version does not provide session.create_client overloads
# it is more RAM-friendly, but requires explicit type annotations
python -m pip install 'types-aiobotocore-lite[essential]'
Now you should be able to run Pylance_, pyright_, or mypy_ for type checking
as well as code completion in your IDE.
For types-aiobotocore-lite package use explicit type annotations:
.. code:: python
from aiobotocore.session import get_session
from types_aiobotocore_s3.client import S3Client
session = get_session()
async with session.create_client("s3") as client:
client: S3Client
# type checking and code completion is now enabled for client
See the types-aiobotocore <https://youtype.github.io/types_aiobotocore_docs/>__ documentation for full reference.
aio-libs/aiobotocore có 1.4k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/aio-libs/aiobotocore. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
aio-libs/aiobotocore có những chủ đề gì?
GitHub topics của aio-libs/aiobotocore: "aiohttp", "asyncio", "aws", "aws-sdk", "botocore", "cloud", "cloud-management". TopGit xếp repo vào nhóm mã nguồn mở.
aio-libs/aiobotocore có phải mã nguồn mở không?
Có — aio-libs/aiobotocore phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/aio-libs/aiobotocore.
aio-libs/aiobotocore có trang demo không?
Dự án có trang chủ ở https://aiobotocore.aio-libs.org. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
aio-libs/aiobotocore còn đang phát triển không?
Commit gần nhất trên aio-libs/aiobotocore là 9 ngày trước (theo timestamp GitHub). Repo có 213 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc thêm về aio-libs/aiobotocore ở đâ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/aio-libs/aiobotocore là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
aiobotocore có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về aiobotocore.