Examples#
Index > APIGateway > Examples
Auto-generated documentation for APIGateway type annotations stubs module types-aiobotocore-apigateway.
Client#
Implicit type annotations#
Can be used with types-aiobotocore[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 aiobotocore.session import get_session
session = get_session()
async with session.create_client("apigateway") as client: # (1)
result = await client.create_api_key() # (2)
- client: APIGatewayClient
- result: ApiKeyResponseTypeDef
Paginator usage example#
# GetApiKeysPaginator usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("apigateway") as client: # (1)
paginator = client.get_paginator("get_api_keys") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: APIGatewayClient
- paginator: GetApiKeysPaginator
- item: ApiKeysTypeDef
Explicit type annotations#
With types-aiobotocore-lite[apigateway]
or a standalone types_aiobotocore_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 aiobotocore.session import get_session
from types_aiobotocore_apigateway.client import APIGatewayClient
from types_aiobotocore_apigateway.type_defs import ApiKeyResponseTypeDef
from types_aiobotocore_apigateway.type_defs import CreateApiKeyRequestTypeDef
session = get_session()
async with session.create_client("apigateway") as client:
client: APIGatewayClient
kwargs: CreateApiKeyRequestTypeDef = {...}
result: ApiKeyResponseTypeDef = await client.create_api_key(**kwargs)
Paginator usage example#
# GetApiKeysPaginator usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_apigateway.client import APIGatewayClient
from types_aiobotocore_apigateway.paginator import GetApiKeysPaginator
from types_aiobotocore_apigateway.type_defs import ApiKeysTypeDef
session = get_session()
async with session.create_client("apigateway") as client:
client: APIGatewayClient
paginator: GetApiKeysPaginator = client.get_paginator("get_api_keys")
async for item in paginator.paginate(...):
item: ApiKeysTypeDef
print(item)