mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
Update quotes in boto3 example
This commit is contained in:
parent
c92a941fe5
commit
4a52595a9d
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user