Examples#
Index > APIGateway > Examples
Auto-generated documentation for APIGateway type annotations stubs module mypy-boto3-apigateway.
Client#
Implicit type annotations#
Can be used with boto3-stubs[apigateway]
package installed.
Write your APIGateway
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# APIGatewayClient usage example
from boto3.session import Session
session = Session()
client = session.client("apigateway") # (1)
result = client.create_api_key() # (2)
- client: APIGatewayClient
- result: ApiKeyResponseTypeDef
Paginator usage example#
# GetApiKeysPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("apigateway") # (1)
paginator = client.get_paginator("get_api_keys") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: APIGatewayClient
- paginator: GetApiKeysPaginator
- item: ApiKeysTypeDef
Explicit type annotations#
With boto3-stubs-lite[apigateway]
or a standalone mypy_boto3_apigateway
package, you have to explicitly specify client: APIGatewayClient
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.
Client method usage example#
# APIGatewayClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_apigateway.client import APIGatewayClient
from mypy_boto3_apigateway.type_defs import ApiKeyResponseTypeDef
from mypy_boto3_apigateway.type_defs import CreateApiKeyRequestTypeDef
session = Session()
client: APIGatewayClient = session.client("apigateway")
kwargs: CreateApiKeyRequestTypeDef = {...}
result: ApiKeyResponseTypeDef = client.create_api_key(**kwargs)
Paginator usage example#
# GetApiKeysPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_apigateway.client import APIGatewayClient
from mypy_boto3_apigateway.paginator import GetApiKeysPaginator
from mypy_boto3_apigateway.type_defs import ApiKeysTypeDef
session = Session()
client: APIGatewayClient = session.client("apigateway")
paginator: GetApiKeysPaginator = client.get_paginator("get_api_keys")
for item in paginator.paginate(...):
item: ApiKeysTypeDef
print(item)