Skip to content

Examples#

Index > Artifact > Examples

Auto-generated documentation for Artifact type annotations stubs module mypy-boto3-artifact.

Client#

Implicit type annotations#

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

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

Client method usage example#

# ArtifactClient usage example

from boto3.session import Session


session = Session()

client = session.client("artifact")  # (1)
result = client.get_report()  # (2)
  1. client: ArtifactClient
  2. result: GetReportResponseTypeDef

Paginator usage example#

# ListCustomerAgreementsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_customer_agreements")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ArtifactClient
  2. paginator: ListCustomerAgreementsPaginator
  3. item: ListCustomerAgreementsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[artifact] or a standalone mypy_boto3_artifact package, you have to explicitly specify client: ArtifactClient 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#

# ArtifactClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_artifact.client import ArtifactClient
from mypy_boto3_artifact.type_defs import GetReportResponseTypeDef
from mypy_boto3_artifact.type_defs import GetReportRequestTypeDef


session = Session()

client: ArtifactClient = session.client("artifact")

kwargs: GetReportRequestTypeDef = {...}
result: GetReportResponseTypeDef = client.get_report(**kwargs)

Paginator usage example#

# ListCustomerAgreementsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_artifact.client import ArtifactClient
from mypy_boto3_artifact.paginator import ListCustomerAgreementsPaginator
from mypy_boto3_artifact.type_defs import ListCustomerAgreementsResponseTypeDef


session = Session()
client: ArtifactClient = session.client("artifact")

paginator: ListCustomerAgreementsPaginator = client.get_paginator("list_customer_agreements")
for item in paginator.paginate(...):
    item: ListCustomerAgreementsResponseTypeDef
    print(item)