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