Examples#
Index > ConfigService > Examples
Auto-generated documentation for ConfigService type annotations stubs module types-boto3-config.
Client#
Implicit type annotations#
Can be used with types-boto3[config]
package installed.
Write your ConfigService
code as usual,
type checking and code completion should work out of the box.
# ConfigServiceClient usage example
from boto3.session import Session
session = Session()
client = session.client("config") # (1)
result = client.associate_resource_types() # (2)
- client: ConfigServiceClient
- result: AssociateResourceTypesResponseTypeDef
# DescribeAggregateComplianceByConfigRulesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("config") # (1)
paginator = client.get_paginator("describe_aggregate_compliance_by_config_rules") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ConfigServiceClient
- paginator: DescribeAggregateComplianceByConfigRulesPaginator
- item: DescribeAggregateComplianceByConfigRulesResponseTypeDef
Explicit type annotations#
With types-boto3-lite[config]
or a standalone types_boto3_config
package, you have to explicitly specify client: ConfigServiceClient
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.
# ConfigServiceClient usage example with type annotations
from boto3.session import Session
from types_boto3_config.client import ConfigServiceClient
from types_boto3_config.type_defs import AssociateResourceTypesResponseTypeDef
from types_boto3_config.type_defs import AssociateResourceTypesRequestRequestTypeDef
session = Session()
client: ConfigServiceClient = session.client("config")
kwargs: AssociateResourceTypesRequestRequestTypeDef = {...}
result: AssociateResourceTypesResponseTypeDef = client.associate_resource_types(**kwargs)
# DescribeAggregateComplianceByConfigRulesPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_config.client import ConfigServiceClient
from types_boto3_config.paginator import DescribeAggregateComplianceByConfigRulesPaginator
from types_boto3_config.type_defs import DescribeAggregateComplianceByConfigRulesResponseTypeDef
session = Session()
client: ConfigServiceClient = session.client("config")
paginator: DescribeAggregateComplianceByConfigRulesPaginator = client.get_paginator("describe_aggregate_compliance_by_config_rules")
for item in paginator.paginate(...):
item: DescribeAggregateComplianceByConfigRulesResponseTypeDef
print(item)