Update quotes in boto3 example

This commit is contained in:
Roman Mogylatov 2021-09-30 15:57:34 -04:00
parent c92a941fe5
commit 4a52595a9d

View File

@ -23,12 +23,12 @@ class Container(containers.DeclarativeContainer):
s3_client = providers.Resource( s3_client = providers.Resource(
session.provided.client.call(), session.provided.client.call(),
service_name='s3', service_name="s3",
) )
sqs_client = providers.Resource( sqs_client = providers.Resource(
providers.MethodCaller(session.provided.client), # Alternative syntax providers.MethodCaller(session.provided.client), # Alternative syntax
service_name='sqs', service_name="sqs",
) )
service1 = providers.Factory( service1 = providers.Factory(
@ -39,16 +39,16 @@ class Container(containers.DeclarativeContainer):
service2 = providers.Factory( service2 = providers.Factory(
Service, Service,
s3_client=session.provided.client.call(service_name='s3'), # Alternative inline syntax s3_client=session.provided.client.call(service_name="s3"), # Alternative inline syntax
sqs_client=session.provided.client.call(service_name='sqs'), # Alternative inline syntax sqs_client=session.provided.client.call(service_name="sqs"), # Alternative inline syntax
) )
def main(): def main():
container = Container() container = Container()
container.config.aws_access_key_id.from_env('AWS_ACCESS_KEY_ID') container.config.aws_access_key_id.from_env("AWS_ACCESS_KEY_ID")
container.config.aws_secret_access_key.from_env('AWS_SECRET_ACCESS_KEY') container.config.aws_secret_access_key.from_env("AWS_SECRET_ACCESS_KEY")
container.config.aws_session_token.from_env('AWS_SESSION_TOKEN') container.config.aws_session_token.from_env("AWS_SESSION_TOKEN")
container.init_resources() container.init_resources()
s3_client = container.s3_client() s3_client = container.s3_client()
@ -68,5 +68,5 @@ def main():
assert service2.sqs_client is sqs_client assert service2.sqs_client is sqs_client
if __name__ == '__main__': if __name__ == "__main__":
main() main()