Skip to content

Examples#

Index > LocationService > Examples

Auto-generated documentation for LocationService type annotations stubs module mypy-boto3-location.

Client#

Implicit type annotations#

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

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

# LocationServiceClient usage example

from boto3.session import Session


session = Session()

client = session.client("location")  # (1)
result = client.batch_delete_device_position_history()  # (2)
  1. client: LocationServiceClient
  2. result: BatchDeleteDevicePositionHistoryResponseTypeDef
# GetDevicePositionHistoryPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_device_position_history")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: LocationServiceClient
  2. paginator: GetDevicePositionHistoryPaginator
  3. item: GetDevicePositionHistoryResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[location] or a standalone mypy_boto3_location package, you have to explicitly specify client: LocationServiceClient 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.

# LocationServiceClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_location.client import LocationServiceClient
from mypy_boto3_location.type_defs import BatchDeleteDevicePositionHistoryResponseTypeDef
from mypy_boto3_location.type_defs import BatchDeleteDevicePositionHistoryRequestRequestTypeDef


session = Session()

client: LocationServiceClient = session.client("location")

kwargs: BatchDeleteDevicePositionHistoryRequestRequestTypeDef = {...}
result: BatchDeleteDevicePositionHistoryResponseTypeDef = client.batch_delete_device_position_history(**kwargs)
# GetDevicePositionHistoryPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_location.client import LocationServiceClient
from mypy_boto3_location.paginator import GetDevicePositionHistoryPaginator
from mypy_boto3_location.type_defs import GetDevicePositionHistoryResponseTypeDef


session = Session()
client: LocationServiceClient = session.client("location")

paginator: GetDevicePositionHistoryPaginator = client.get_paginator("get_device_position_history")
for item in paginator.paginate(...):
    item: GetDevicePositionHistoryResponseTypeDef
    print(item)