コード例 #1
0
async def s3_client(request, region, config, event_loop, s3_server,
                    bucket_name):
    session = Session(region_name=region, **moto_config())

    async with session.client('s3',
                              region_name=region,
                              endpoint_url=s3_server,
                              config=config) as client:
        yield client
コード例 #2
0
async def s3_resource(request, region, config, event_loop, s3_server,
                      bucket_name):
    session = Session(region_name=region, **moto_config())

    async with session.resource('s3',
                                region_name=region,
                                endpoint_url=s3_server,
                                config=config) as resource:
        yield resource
コード例 #3
0
async def dynamodb_resource(request, region, config, event_loop,
                            dynamodb2_server):
    session = Session(region_name=region, **moto_config())

    async with session.resource('dynamodb',
                                region_name=region,
                                endpoint_url=dynamodb2_server,
                                config=config) as resource:
        yield resource
コード例 #4
0
def s3_client(request, region, config, event_loop, s3_server, bucket_name):
    session = Session(region_name=region, loop=event_loop, **moto_config())
    client = session.client('s3', region_name=region, endpoint_url=s3_server, config=config)
    yield client

    def fin():
        event_loop.run_until_complete(client.close())

    request.addfinalizer(fin)
コード例 #5
0
def dynamodb_resource(request, region, config, event_loop, dynamodb2_server):
    session = Session(region_name=region, loop=event_loop, **moto_config())
    resource = session.resource('dynamodb', region_name=region, endpoint_url=dynamodb2_server, config=config)
    yield resource

    def fin():
        event_loop.run_until_complete(resource.close())

    request.addfinalizer(fin)
コード例 #6
0
ファイル: __init__.py プロジェクト: zackhsi/aioboto3
def setup_default_session(**kwargs):
    """
    Set up a default session, passing through any parameters to the session
    constructor. There is no need to call this unless you wish to pass custom
    parameters, because a default session will be created for you.
    """
    global DEFAULT_SESSION
    DEFAULT_SESSION = Session(**kwargs)
コード例 #7
0
def s3_resource(request, region, config, event_loop, s3_server, bucket_name):
    session = Session(region_name=region, loop=event_loop, **moto_config())

    async def f():
        return session.resource('s3',
                                region_name=region,
                                endpoint_url=s3_server,
                                config=config)

    resource = event_loop.run_until_complete(f())

    yield resource

    def fin():
        event_loop.run_until_complete(resource.close())

    request.addfinalizer(fin)