Skip to content

Examples#

Index > GlobalAccelerator > Examples

Auto-generated documentation for GlobalAccelerator type annotations stubs module types-boto3-globalaccelerator.

Client#

Implicit type annotations#

Can be used with types-boto3[globalaccelerator] package installed.

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

# GlobalAcceleratorClient usage example

from boto3.session import Session


session = Session()

client = session.client("globalaccelerator")  # (1)
result = client.add_custom_routing_endpoints()  # (2)
  1. client: GlobalAcceleratorClient
  2. result: AddCustomRoutingEndpointsResponseTypeDef
# ListAcceleratorsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("globalaccelerator")  # (1)

paginator = client.get_paginator("list_accelerators")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: GlobalAcceleratorClient
  2. paginator: ListAcceleratorsPaginator
  3. item: ListAcceleratorsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[globalaccelerator] or a standalone types_boto3_globalaccelerator package, you have to explicitly specify client: GlobalAcceleratorClient 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.

# GlobalAcceleratorClient usage example with type annotations

from boto3.session import Session

from types_boto3_globalaccelerator.client import GlobalAcceleratorClient
from types_boto3_globalaccelerator.type_defs import AddCustomRoutingEndpointsResponseTypeDef
from types_boto3_globalaccelerator.type_defs import AddCustomRoutingEndpointsRequestRequestTypeDef


session = Session()

client: GlobalAcceleratorClient = session.client("globalaccelerator")

kwargs: AddCustomRoutingEndpointsRequestRequestTypeDef = {...}
result: AddCustomRoutingEndpointsResponseTypeDef = client.add_custom_routing_endpoints(**kwargs)
# ListAcceleratorsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_globalaccelerator.client import GlobalAcceleratorClient
from types_boto3_globalaccelerator.paginator import ListAcceleratorsPaginator
from types_boto3_globalaccelerator.type_defs import ListAcceleratorsResponseTypeDef


session = Session()
client: GlobalAcceleratorClient = session.client("globalaccelerator")

paginator: ListAcceleratorsPaginator = client.get_paginator("list_accelerators")
for item in paginator.paginate(...):
    item: ListAcceleratorsResponseTypeDef
    print(item)