Skip to content

Examples#

Index > TrustedAdvisorPublicAPI > Examples

Auto-generated documentation for TrustedAdvisorPublicAPI type annotations stubs module mypy-boto3-trustedadvisor.

Client#

Implicit type annotations#

Can be used with boto3-stubs[trustedadvisor] package installed.

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

# TrustedAdvisorPublicAPIClient usage example

from boto3.session import Session


session = Session()

client = session.client("trustedadvisor")  # (1)
result = client.get_organization_recommendation()  # (2)
  1. client: TrustedAdvisorPublicAPIClient
  2. result: GetOrganizationRecommendationResponseTypeDef
# ListChecksPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_checks")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: TrustedAdvisorPublicAPIClient
  2. paginator: ListChecksPaginator
  3. item: ListChecksResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[trustedadvisor] or a standalone mypy_boto3_trustedadvisor package, you have to explicitly specify client: TrustedAdvisorPublicAPIClient 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.

# TrustedAdvisorPublicAPIClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_trustedadvisor.client import TrustedAdvisorPublicAPIClient
from mypy_boto3_trustedadvisor.type_defs import GetOrganizationRecommendationResponseTypeDef
from mypy_boto3_trustedadvisor.type_defs import GetOrganizationRecommendationRequestRequestTypeDef


session = Session()

client: TrustedAdvisorPublicAPIClient = session.client("trustedadvisor")

kwargs: GetOrganizationRecommendationRequestRequestTypeDef = {...}
result: GetOrganizationRecommendationResponseTypeDef = client.get_organization_recommendation(**kwargs)
# ListChecksPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_trustedadvisor.client import TrustedAdvisorPublicAPIClient
from mypy_boto3_trustedadvisor.paginator import ListChecksPaginator
from mypy_boto3_trustedadvisor.type_defs import ListChecksResponseTypeDef


session = Session()
client: TrustedAdvisorPublicAPIClient = session.client("trustedadvisor")

paginator: ListChecksPaginator = client.get_paginator("list_checks")
for item in paginator.paginate(...):
    item: ListChecksResponseTypeDef
    print(item)