Skip to content

Examples#

Index > GameLift > Examples

Auto-generated documentation for GameLift type annotations stubs module types-aiobotocore-gamelift.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[gamelift] package installed.

Write your GameLift code as usual, type checking and code completion should work out of the box.

# GameLiftClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("gamelift") as client:  # (1)
    result = await client.claim_game_server()  # (2)
  1. client: GameLiftClient
  2. result: ClaimGameServerOutputTypeDef
# DescribeFleetAttributesPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("gamelift") as client:  # (1)
    paginator = client.get_paginator("describe_fleet_attributes")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: GameLiftClient
  2. paginator: DescribeFleetAttributesPaginator
  3. item: DescribeFleetAttributesOutputTypeDef

Explicit type annotations#

With types-aiobotocore-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 aiobotocore.session import get_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 = get_session()

async with session.create_client("gamelift") as client:
    client: GameLiftClient
    kwargs: ClaimGameServerInputRequestTypeDef = {...}
    result: ClaimGameServerOutputTypeDef = await client.claim_game_server(**kwargs)
# DescribeFleetAttributesPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_gamelift.client import GameLiftClient
from types_aiobotocore_gamelift.paginator import DescribeFleetAttributesPaginator
from types_aiobotocore_gamelift.type_defs import DescribeFleetAttributesOutputTypeDef


session = get_session()

async with session.create_client("gamelift") as client:
    client: GameLiftClient
    paginator: DescribeFleetAttributesPaginator = client.get_paginator("describe_fleet_attributes")
    async for item in paginator.paginate(...):
        item: DescribeFleetAttributesOutputTypeDef
        print(item)