Skip to content

Examples#

Index > FreeTier > Examples

Auto-generated documentation for FreeTier type annotations stubs module types-aiobotocore-freetier.

Client#

Implicit type annotations#

Can be used with types-aioboto3[freetier] package installed.

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

# FreeTierClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("freetier") as client:  # (1)
    result = await client.get_free_tier_usage()  # (2)
  1. client: FreeTierClient
  2. result: GetFreeTierUsageResponseTypeDef
# GetFreeTierUsagePaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("freetier") as client:  # (1)
    paginator = client.get_paginator("get_free_tier_usage")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: FreeTierClient
  2. paginator: GetFreeTierUsagePaginator
  3. item: GetFreeTierUsageResponseTypeDef

Explicit type annotations#

With types-aioboto3-lite[freetier] or a standalone types_aiobotocore_freetier package, you have to explicitly specify client: FreeTierClient 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.

# FreeTierClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_freetier.client import FreeTierClient
from types_aiobotocore_freetier.type_defs import GetFreeTierUsageResponseTypeDef
from types_aiobotocore_freetier.type_defs import GetFreeTierUsageRequestRequestTypeDef


session = Session()

client: FreeTierClient
async with session.client("freetier") as client:  # (1)
    kwargs: GetFreeTierUsageRequestRequestTypeDef = {...}  # (2)
    result: GetFreeTierUsageResponseTypeDef = await client.get_free_tier_usage(**kwargs)  # (3)
  1. client: FreeTierClient
  2. kwargs: GetFreeTierUsageRequestRequestTypeDef
  3. result: GetFreeTierUsageResponseTypeDef
# GetFreeTierUsagePaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_freetier.client import FreeTierClient
from types_aiobotocore_freetier.paginator import GetFreeTierUsagePaginator
from types_aiobotocore_freetier.type_defs import GetFreeTierUsageResponseTypeDef


session = Session()

client: FreeTierClient
async with session.client("freetier") as client:  # (1)
    paginator: GetFreeTierUsagePaginator = client.get_paginator("get_free_tier_usage")  # (2)
    async for item in paginator.paginate(...):
        item: GetFreeTierUsageResponseTypeDef
        print(item)  # (3)
  1. client: FreeTierClient
  2. paginator: GetFreeTierUsagePaginator
  3. item: GetFreeTierUsageResponseTypeDef