Skip to content

Examples#

Index > ServiceQuotas > Examples

Auto-generated documentation for ServiceQuotas type annotations stubs module mypy-boto3-service-quotas.

Client#

Implicit type annotations#

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

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

# ServiceQuotasClient usage example

from boto3.session import Session


session = Session()

client = session.client("service-quotas")  # (1)
result = client.get_aws_default_service_quota()  # (2)
  1. client: ServiceQuotasClient
  2. result: GetAWSDefaultServiceQuotaResponseTypeDef
# ListAWSDefaultServiceQuotasPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("service-quotas")  # (1)

paginator = client.get_paginator("list_aws_default_service_quotas")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ServiceQuotasClient
  2. paginator: ListAWSDefaultServiceQuotasPaginator
  3. item: ListAWSDefaultServiceQuotasResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[service-quotas] or a standalone mypy_boto3_service_quotas package, you have to explicitly specify client: ServiceQuotasClient 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.

# ServiceQuotasClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_service_quotas.client import ServiceQuotasClient
from mypy_boto3_service_quotas.type_defs import GetAWSDefaultServiceQuotaResponseTypeDef
from mypy_boto3_service_quotas.type_defs import GetAWSDefaultServiceQuotaRequestRequestTypeDef


session = Session()

client: ServiceQuotasClient = session.client("service-quotas")

kwargs: GetAWSDefaultServiceQuotaRequestRequestTypeDef = {...}
result: GetAWSDefaultServiceQuotaResponseTypeDef = client.get_aws_default_service_quota(**kwargs)
# ListAWSDefaultServiceQuotasPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_service_quotas.client import ServiceQuotasClient
from mypy_boto3_service_quotas.paginator import ListAWSDefaultServiceQuotasPaginator
from mypy_boto3_service_quotas.type_defs import ListAWSDefaultServiceQuotasResponseTypeDef


session = Session()
client: ServiceQuotasClient = session.client("service-quotas")

paginator: ListAWSDefaultServiceQuotasPaginator = client.get_paginator("list_aws_default_service_quotas")
for item in paginator.paginate(...):
    item: ListAWSDefaultServiceQuotasResponseTypeDef
    print(item)