Examples#
Index > ElasticBeanstalk > Examples
Auto-generated documentation for ElasticBeanstalk type annotations stubs module mypy-boto3-elasticbeanstalk.
Client#
Implicit type annotations#
Can be used with boto3-stubs[elasticbeanstalk]
package installed.
Write your ElasticBeanstalk
code as usual,
type checking and code completion should work out of the box.
# ElasticBeanstalkClient usage example
from boto3.session import Session
session = Session()
client = session.client("elasticbeanstalk") # (1)
result = client.abort_environment_update() # (2)
- client: ElasticBeanstalkClient
- result: EmptyResponseMetadataTypeDef
# DescribeApplicationVersionsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("elasticbeanstalk") # (1)
paginator = client.get_paginator("describe_application_versions") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ElasticBeanstalkClient
- paginator: DescribeApplicationVersionsPaginator
- item: ApplicationVersionDescriptionsMessageTypeDef
# EnvironmentExistsWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("elasticbeanstalk") # (1)
waiter = client.get_waiter("environment_exists") # (2)
waiter.wait()
- client: ElasticBeanstalkClient
- waiter: EnvironmentExistsWaiter
Explicit type annotations#
With boto3-stubs-lite[elasticbeanstalk]
or a standalone mypy_boto3_elasticbeanstalk
package, you have to explicitly specify client: ElasticBeanstalkClient
type annotation.
All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.
# ElasticBeanstalkClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_elasticbeanstalk.client import ElasticBeanstalkClient
from mypy_boto3_elasticbeanstalk.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_elasticbeanstalk.type_defs import AbortEnvironmentUpdateMessageRequestTypeDef
session = Session()
client: ElasticBeanstalkClient = session.client("elasticbeanstalk")
kwargs: AbortEnvironmentUpdateMessageRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.abort_environment_update(**kwargs)
# DescribeApplicationVersionsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_elasticbeanstalk.client import ElasticBeanstalkClient
from mypy_boto3_elasticbeanstalk.paginator import DescribeApplicationVersionsPaginator
from mypy_boto3_elasticbeanstalk.type_defs import ApplicationVersionDescriptionsMessageTypeDef
session = Session()
client: ElasticBeanstalkClient = session.client("elasticbeanstalk")
paginator: DescribeApplicationVersionsPaginator = client.get_paginator("describe_application_versions")
for item in paginator.paginate(...):
item: ApplicationVersionDescriptionsMessageTypeDef
print(item)
# EnvironmentExistsWaiter usage example with type annotations
from boto3.session import Session
from mypy_boto3_elasticbeanstalk.client import ElasticBeanstalkClient
from mypy_boto3_elasticbeanstalk.waiter import EnvironmentExistsWaiter
session = Session()
client: ElasticBeanstalkClient = session.client("elasticbeanstalk")
waiter: EnvironmentExistsWaiter = client.get_waiter("environment_exists")
waiter.wait()