Skip to content

Examples#

Index > MarketplaceEntitlementService > Examples

Auto-generated documentation for MarketplaceEntitlementService type annotations stubs module mypy-boto3-marketplace-entitlement.

Client#

Implicit type annotations#

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

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

# MarketplaceEntitlementServiceClient usage example

from boto3.session import Session


session = Session()

client = session.client("marketplace-entitlement")  # (1)
result = client.get_entitlements()  # (2)
  1. client: MarketplaceEntitlementServiceClient
  2. result: GetEntitlementsResultTypeDef
# GetEntitlementsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("marketplace-entitlement")  # (1)

paginator = client.get_paginator("get_entitlements")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: MarketplaceEntitlementServiceClient
  2. paginator: GetEntitlementsPaginator
  3. item: GetEntitlementsResultTypeDef

Explicit type annotations#

With boto3-stubs-lite[marketplace-entitlement] or a standalone mypy_boto3_marketplace_entitlement package, you have to explicitly specify client: MarketplaceEntitlementServiceClient 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.

# MarketplaceEntitlementServiceClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_marketplace_entitlement.client import MarketplaceEntitlementServiceClient
from mypy_boto3_marketplace_entitlement.type_defs import GetEntitlementsResultTypeDef
from mypy_boto3_marketplace_entitlement.type_defs import GetEntitlementsRequestRequestTypeDef


session = Session()

client: MarketplaceEntitlementServiceClient = session.client("marketplace-entitlement")

kwargs: GetEntitlementsRequestRequestTypeDef = {...}
result: GetEntitlementsResultTypeDef = client.get_entitlements(**kwargs)
# GetEntitlementsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_marketplace_entitlement.client import MarketplaceEntitlementServiceClient
from mypy_boto3_marketplace_entitlement.paginator import GetEntitlementsPaginator
from mypy_boto3_marketplace_entitlement.type_defs import GetEntitlementsResultTypeDef


session = Session()
client: MarketplaceEntitlementServiceClient = session.client("marketplace-entitlement")

paginator: GetEntitlementsPaginator = client.get_paginator("get_entitlements")
for item in paginator.paginate(...):
    item: GetEntitlementsResultTypeDef
    print(item)