Examples#
Auto-generated documentation for XRay type annotations stubs module types-aiobotocore-xray.
Client#
Implicit type annotations#
Can be used with types-aiobotocore[xray]
package installed.
Write your XRay
code as usual,
type checking and code completion should work out of the box.
# XRayClient usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("xray") as client: # (1)
result = await client.batch_get_traces() # (2)
- client: XRayClient
- result: BatchGetTracesResultTypeDef
# BatchGetTracesPaginator usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("xray") as client: # (1)
paginator = client.get_paginator("batch_get_traces") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: XRayClient
- paginator: BatchGetTracesPaginator
- item: BatchGetTracesResultTypeDef
Explicit type annotations#
With types-aiobotocore-lite[xray]
or a standalone types_aiobotocore_xray
package, you have to explicitly specify
client: XRayClient
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.
# XRayClient usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_xray.client import XRayClient
from types_aiobotocore_xray.type_defs import BatchGetTracesResultTypeDef
from types_aiobotocore_xray.type_defs import BatchGetTracesRequestRequestTypeDef
session = get_session()
async with session.create_client("xray") as client:
client: XRayClient
kwargs: BatchGetTracesRequestRequestTypeDef = {...}
result: BatchGetTracesResultTypeDef = await client.batch_get_traces(**kwargs)
# BatchGetTracesPaginator usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_xray.client import XRayClient
from types_aiobotocore_xray.paginator import BatchGetTracesPaginator
from types_aiobotocore_xray.type_defs import BatchGetTracesResultTypeDef
session = get_session()
async with session.create_client("xray") as client:
client: XRayClient
paginator: BatchGetTracesPaginator = client.get_paginator("batch_get_traces")
async for item in paginator.paginate(...):
item: BatchGetTracesResultTypeDef
print(item)