Examples#
Auto-generated documentation for Inspector type annotations stubs module mypy-boto3-inspector.
Client#
Implicit type annotations#
Can be used with boto3-stubs[inspector]
package installed.
Write your Inspector
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# InspectorClient usage example
from boto3.session import Session
session = Session()
client = session.client("inspector") # (1)
result = client.add_attributes_to_findings() # (2)
- client: InspectorClient
- result: AddAttributesToFindingsResponseTypeDef
Paginator usage example#
# ListAssessmentRunAgentsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("inspector") # (1)
paginator = client.get_paginator("list_assessment_run_agents") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: InspectorClient
- paginator: ListAssessmentRunAgentsPaginator
- item: ListAssessmentRunAgentsResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[inspector]
or a standalone mypy_boto3_inspector
package, you have to explicitly specify client: InspectorClient
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#
# InspectorClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_inspector.client import InspectorClient
from mypy_boto3_inspector.type_defs import AddAttributesToFindingsResponseTypeDef
from mypy_boto3_inspector.type_defs import AddAttributesToFindingsRequestTypeDef
session = Session()
client: InspectorClient = session.client("inspector")
kwargs: AddAttributesToFindingsRequestTypeDef = {...}
result: AddAttributesToFindingsResponseTypeDef = client.add_attributes_to_findings(**kwargs)
Paginator usage example#
# ListAssessmentRunAgentsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_inspector.client import InspectorClient
from mypy_boto3_inspector.paginator import ListAssessmentRunAgentsPaginator
from mypy_boto3_inspector.type_defs import ListAssessmentRunAgentsResponseTypeDef
session = Session()
client: InspectorClient = session.client("inspector")
paginator: ListAssessmentRunAgentsPaginator = client.get_paginator("list_assessment_run_agents")
for item in paginator.paginate(...):
item: ListAssessmentRunAgentsResponseTypeDef
print(item)