Examples#
Index > CodeArtifact > Examples
Auto-generated documentation for CodeArtifact type annotations stubs module types-boto3-codeartifact.
Client#
Implicit type annotations#
Can be used with types-boto3[codeartifact]
package installed.
Write your CodeArtifact
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# CodeArtifactClient usage example
from boto3.session import Session
session = Session()
client = session.client("codeartifact") # (1)
result = client.associate_external_connection() # (2)
- client: CodeArtifactClient
- result: AssociateExternalConnectionResultTypeDef
Paginator usage example#
# ListAllowedRepositoriesForGroupPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("codeartifact") # (1)
paginator = client.get_paginator("list_allowed_repositories_for_group") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: CodeArtifactClient
- paginator: ListAllowedRepositoriesForGroupPaginator
- item: ListAllowedRepositoriesForGroupResultTypeDef
Explicit type annotations#
With types-boto3-lite[codeartifact]
or a standalone types_boto3_codeartifact
package, you have to explicitly specify client: CodeArtifactClient
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#
# CodeArtifactClient usage example with type annotations
from boto3.session import Session
from types_boto3_codeartifact.client import CodeArtifactClient
from types_boto3_codeartifact.type_defs import AssociateExternalConnectionResultTypeDef
from types_boto3_codeartifact.type_defs import AssociateExternalConnectionRequestTypeDef
session = Session()
client: CodeArtifactClient = session.client("codeartifact")
kwargs: AssociateExternalConnectionRequestTypeDef = {...}
result: AssociateExternalConnectionResultTypeDef = client.associate_external_connection(**kwargs)
Paginator usage example#
# ListAllowedRepositoriesForGroupPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_codeartifact.client import CodeArtifactClient
from types_boto3_codeartifact.paginator import ListAllowedRepositoriesForGroupPaginator
from types_boto3_codeartifact.type_defs import ListAllowedRepositoriesForGroupResultTypeDef
session = Session()
client: CodeArtifactClient = session.client("codeartifact")
paginator: ListAllowedRepositoriesForGroupPaginator = client.get_paginator("list_allowed_repositories_for_group")
for item in paginator.paginate(...):
item: ListAllowedRepositoriesForGroupResultTypeDef
print(item)