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