Skip to content

Examples#

Index > LicenseManager > Examples

Auto-generated documentation for LicenseManager type annotations stubs module mypy-boto3-license-manager.

Client#

Implicit type annotations#

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

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

# LicenseManagerClient usage example

from boto3.session import Session


session = Session()

client = session.client("license-manager")  # (1)
result = client.accept_grant()  # (2)
  1. client: LicenseManagerClient
  2. result: AcceptGrantResponseTypeDef
# ListAssociationsForLicenseConfigurationPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("license-manager")  # (1)

paginator = client.get_paginator("list_associations_for_license_configuration")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: LicenseManagerClient
  2. paginator: ListAssociationsForLicenseConfigurationPaginator
  3. item: ListAssociationsForLicenseConfigurationResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[license-manager] or a standalone mypy_boto3_license_manager package, you have to explicitly specify client: LicenseManagerClient 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.

# LicenseManagerClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_license_manager.client import LicenseManagerClient
from mypy_boto3_license_manager.type_defs import AcceptGrantResponseTypeDef
from mypy_boto3_license_manager.type_defs import AcceptGrantRequestRequestTypeDef


session = Session()

client: LicenseManagerClient = session.client("license-manager")

kwargs: AcceptGrantRequestRequestTypeDef = {...}
result: AcceptGrantResponseTypeDef = client.accept_grant(**kwargs)
# ListAssociationsForLicenseConfigurationPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_license_manager.client import LicenseManagerClient
from mypy_boto3_license_manager.paginator import ListAssociationsForLicenseConfigurationPaginator
from mypy_boto3_license_manager.type_defs import ListAssociationsForLicenseConfigurationResponseTypeDef


session = Session()
client: LicenseManagerClient = session.client("license-manager")

paginator: ListAssociationsForLicenseConfigurationPaginator = client.get_paginator("list_associations_for_license_configuration")
for item in paginator.paginate(...):
    item: ListAssociationsForLicenseConfigurationResponseTypeDef
    print(item)