Examples#
Auto-generated documentation for GameLift type annotations stubs module types-aiobotocore-gamelift.
Client#
Implicit type annotations#
Can be used with types-aioboto3[gamelift]
package installed.
Write your GameLift
code as usual,
type checking and code completion should work out of the box.
# GameLiftClient usage example
from aioboto3.session import Session
session = Session()
async with session.client("gamelift") as client: # (1)
result = await client.claim_game_server() # (2)
- client: GameLiftClient
- result: ClaimGameServerOutputTypeDef
# DescribeFleetAttributesPaginator usage example
from aioboto3.session import Session
session = Session()
async with session.client("gamelift") as client: # (1)
paginator = client.get_paginator("describe_fleet_attributes") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: GameLiftClient
- paginator: DescribeFleetAttributesPaginator
- item: DescribeFleetAttributesOutputTypeDef
Explicit type annotations#
With types-aioboto3-lite[gamelift]
or a standalone types_aiobotocore_gamelift
package, you have to explicitly specify
client: GameLiftClient
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.
# GameLiftClient usage example with type annotations
from aioboto3.session import Session
from types_aiobotocore_gamelift.client import GameLiftClient
from types_aiobotocore_gamelift.type_defs import ClaimGameServerOutputTypeDef
from types_aiobotocore_gamelift.type_defs import ClaimGameServerInputRequestTypeDef
session = Session()
client: GameLiftClient
async with session.client("gamelift") as client: # (1)
kwargs: ClaimGameServerInputRequestTypeDef = {...} # (2)
result: ClaimGameServerOutputTypeDef = await client.claim_game_server(**kwargs) # (3)
- client: GameLiftClient
- kwargs: ClaimGameServerInputRequestTypeDef
- result: ClaimGameServerOutputTypeDef
# DescribeFleetAttributesPaginator usage example with type annotations
from aioboto3.session import Session
from types_aiobotocore_gamelift.client import GameLiftClient
from types_aiobotocore_gamelift.paginator import DescribeFleetAttributesPaginator
from types_aiobotocore_gamelift.type_defs import DescribeFleetAttributesOutputTypeDef
session = Session()
client: GameLiftClient
async with session.client("gamelift") as client: # (1)
paginator: DescribeFleetAttributesPaginator = client.get_paginator("describe_fleet_attributes") # (2)
async for item in paginator.paginate(...):
item: DescribeFleetAttributesOutputTypeDef
print(item) # (3)
- client: GameLiftClient
- paginator: DescribeFleetAttributesPaginator
- item: DescribeFleetAttributesOutputTypeDef