Examples#
Auto-generated documentation for AppMesh type annotations stubs module mypy-boto3-appmesh.
Client#
Implicit type annotations#
Can be used with boto3-stubs[appmesh]
package installed.
Write your AppMesh
code as usual,
type checking and code completion should work out of the box.
# AppMeshClient usage example
from boto3.session import Session
session = Session()
client = session.client("appmesh") # (1)
result = client.create_gateway_route() # (2)
- client: AppMeshClient
- result: CreateGatewayRouteOutputTypeDef
# ListGatewayRoutesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("appmesh") # (1)
paginator = client.get_paginator("list_gateway_routes") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: AppMeshClient
- paginator: ListGatewayRoutesPaginator
- item: ListGatewayRoutesOutputTypeDef
Explicit type annotations#
With boto3-stubs-lite[appmesh]
or a standalone mypy_boto3_appmesh
package, you have to explicitly specify client: AppMeshClient
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.
# AppMeshClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_appmesh.client import AppMeshClient
from mypy_boto3_appmesh.type_defs import CreateGatewayRouteOutputTypeDef
from mypy_boto3_appmesh.type_defs import CreateGatewayRouteInputRequestTypeDef
session = Session()
client: AppMeshClient = session.client("appmesh")
kwargs: CreateGatewayRouteInputRequestTypeDef = {...}
result: CreateGatewayRouteOutputTypeDef = client.create_gateway_route(**kwargs)
# ListGatewayRoutesPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_appmesh.client import AppMeshClient
from mypy_boto3_appmesh.paginator import ListGatewayRoutesPaginator
from mypy_boto3_appmesh.type_defs import ListGatewayRoutesOutputTypeDef
session = Session()
client: AppMeshClient = session.client("appmesh")
paginator: ListGatewayRoutesPaginator = client.get_paginator("list_gateway_routes")
for item in paginator.paginate(...):
item: ListGatewayRoutesOutputTypeDef
print(item)