Skip to content

Examples#

Index > FreeTier > Examples

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

Client#

Implicit type annotations#

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

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

Client method usage example#

# FreeTierClient usage example

from boto3.session import Session


session = Session()

client = session.client("freetier")  # (1)
result = client.get_free_tier_usage()  # (2)
  1. client: FreeTierClient
  2. result: GetFreeTierUsageResponseTypeDef

Paginator usage example#

# GetFreeTierUsagePaginator usage example

from boto3.session import Session


session = Session()
client = session.client("freetier")  # (1)

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

Explicit type annotations#

With types-boto3-lite[freetier] or a standalone types_boto3_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.

Client method usage example#

# FreeTierClient usage example with type annotations

from boto3.session import Session

from types_boto3_freetier.client import FreeTierClient
from types_boto3_freetier.type_defs import GetFreeTierUsageResponseTypeDef
from types_boto3_freetier.type_defs import GetFreeTierUsageRequestTypeDef


session = Session()

client: FreeTierClient = session.client("freetier")

kwargs: GetFreeTierUsageRequestTypeDef = {...}
result: GetFreeTierUsageResponseTypeDef = client.get_free_tier_usage(**kwargs)

Paginator usage example#

# GetFreeTierUsagePaginator usage example with type annotations

from boto3.session import Session

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


session = Session()
client: FreeTierClient = session.client("freetier")

paginator: GetFreeTierUsagePaginator = client.get_paginator("get_free_tier_usage")
for item in paginator.paginate(...):
    item: GetFreeTierUsageResponseTypeDef
    print(item)