SQSClient#
Auto-generated documentation for SQS type annotations stubs module types-aiobotocore-sqs.
SQSClient#
Type annotations and code completion for session.client("sqs")
boto3 documentation
# SQSClient usage example
from aioboto3.session import Session
from types_aiobotocore_sqs.client import SQSClient
session = Session()
async with session.client("sqs") as client:
client: SQSClient
Exceptions#
aioboto3 client exceptions are generated in runtime.
This class provides code completion for session.client("sqs").exceptions structure.
# SQSClient.exceptions usage example
async with session.client("sqs") as client:
try:
do_something(client)
except (
client.exceptions.BatchEntryIdsNotDistinct,
client.exceptions.BatchRequestTooLong,
client.exceptions.ClientError,
client.exceptions.EmptyBatchRequest,
client.exceptions.InvalidAddress,
client.exceptions.InvalidAttributeName,
client.exceptions.InvalidAttributeValue,
client.exceptions.InvalidBatchEntryId,
client.exceptions.InvalidIdFormat,
client.exceptions.InvalidMessageContents,
client.exceptions.InvalidSecurity,
client.exceptions.KmsAccessDenied,
client.exceptions.KmsDisabled,
client.exceptions.KmsInvalidKeyUsage,
client.exceptions.KmsInvalidState,
client.exceptions.KmsNotFound,
client.exceptions.KmsOptInRequired,
client.exceptions.KmsThrottled,
client.exceptions.MessageNotInflight,
client.exceptions.OverLimit,
client.exceptions.PurgeQueueInProgress,
client.exceptions.QueueDeletedRecently,
client.exceptions.QueueDoesNotExist,
client.exceptions.QueueNameExists,
client.exceptions.ReceiptHandleIsInvalid,
client.exceptions.RequestThrottled,
client.exceptions.ResourceNotFoundException,
client.exceptions.TooManyEntriesInBatchRequest,
client.exceptions.UnsupportedOperation,
) as e:
print(e)
# SQSClient.exceptions type checking example
from types_aiobotocore_sqs.client import Exceptions
def handle_error(exc: Exceptions.BatchEntryIdsNotDistinct) -> None:
...
Methods#
can_paginate#
Type annotations and code completion for session.client("sqs").can_paginate method.
boto3 documentation
# can_paginate method definition
def can_paginate(
self,
operation_name: str,
) -> bool:
...
generate_presigned_url#
Type annotations and code completion for session.client("sqs").generate_presigned_url method.
boto3 documentation
# generate_presigned_url method definition
await def generate_presigned_url(
self,
ClientMethod: str,
Params: Mapping[str, Any] = ...,
ExpiresIn: int = 3600,
HttpMethod: str = ...,
) -> str:
...
add_permission#
Adds a permission to a queue for a specific principal.
Type annotations and code completion for session.client("sqs").add_permission method.
boto3 documentation
# add_permission method definition
await def add_permission(
self,
*,
QueueUrl: str,
Label: str,
AWSAccountIds: Sequence[str],
Actions: Sequence[str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
# add_permission method usage example with argument unpacking
kwargs: AddPermissionRequestTypeDef = { # (1)
"QueueUrl": ...,
"Label": ...,
"AWSAccountIds": ...,
"Actions": ...,
}
parent.add_permission(**kwargs)
cancel_message_move_task#
Cancels a specified message movement task.
Type annotations and code completion for session.client("sqs").cancel_message_move_task method.
boto3 documentation
# cancel_message_move_task method definition
await def cancel_message_move_task(
self,
*,
TaskHandle: str,
) -> CancelMessageMoveTaskResultTypeDef: # (1)
...
# cancel_message_move_task method usage example with argument unpacking
kwargs: CancelMessageMoveTaskRequestTypeDef = { # (1)
"TaskHandle": ...,
}
parent.cancel_message_move_task(**kwargs)
change_message_visibility#
Changes the visibility timeout of a specified message in a queue to a new value.
Type annotations and code completion for session.client("sqs").change_message_visibility method.
boto3 documentation
# change_message_visibility method definition
await def change_message_visibility(
self,
*,
QueueUrl: str,
ReceiptHandle: str,
VisibilityTimeout: int,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# change_message_visibility method usage example with argument unpacking
kwargs: ChangeMessageVisibilityRequestTypeDef = { # (1)
"QueueUrl": ...,
"ReceiptHandle": ...,
"VisibilityTimeout": ...,
}
parent.change_message_visibility(**kwargs)
change_message_visibility_batch#
Changes the visibility timeout of multiple messages.
Type annotations and code completion for session.client("sqs").change_message_visibility_batch method.
boto3 documentation
# change_message_visibility_batch method definition
await def change_message_visibility_batch(
self,
*,
QueueUrl: str,
Entries: Sequence[ChangeMessageVisibilityBatchRequestEntryTypeDef], # (1)
) -> ChangeMessageVisibilityBatchResultTypeDef: # (2)
...
- See
Sequence[ChangeMessageVisibilityBatchRequestEntryTypeDef] - See ChangeMessageVisibilityBatchResultTypeDef
# change_message_visibility_batch method usage example with argument unpacking
kwargs: ChangeMessageVisibilityBatchRequestTypeDef = { # (1)
"QueueUrl": ...,
"Entries": ...,
}
parent.change_message_visibility_batch(**kwargs)
create_queue#
Creates a new standard or FIFO queue.
Type annotations and code completion for session.client("sqs").create_queue method.
boto3 documentation
# create_queue method definition
await def create_queue(
self,
*,
QueueName: str,
Attributes: Mapping[QueueAttributeNameType, str] = ..., # (1)
tags: Mapping[str, str] = ...,
) -> CreateQueueResultTypeDef: # (2)
...
- See
Mapping[QueueAttributeNameType, str] - See CreateQueueResultTypeDef
# create_queue method usage example with argument unpacking
kwargs: CreateQueueRequestTypeDef = { # (1)
"QueueName": ...,
}
parent.create_queue(**kwargs)
delete_message#
Deletes the specified message from the specified queue.
Type annotations and code completion for session.client("sqs").delete_message method.
boto3 documentation
# delete_message method definition
await def delete_message(
self,
*,
QueueUrl: str,
ReceiptHandle: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# delete_message method usage example with argument unpacking
kwargs: DeleteMessageRequestTypeDef = { # (1)
"QueueUrl": ...,
"ReceiptHandle": ...,
}
parent.delete_message(**kwargs)
delete_message_batch#
Deletes up to ten messages from the specified queue.
Type annotations and code completion for session.client("sqs").delete_message_batch method.
boto3 documentation
# delete_message_batch method definition
await def delete_message_batch(
self,
*,
QueueUrl: str,
Entries: Sequence[DeleteMessageBatchRequestEntryTypeDef], # (1)
) -> DeleteMessageBatchResultTypeDef: # (2)
...
- See
Sequence[DeleteMessageBatchRequestEntryTypeDef] - See DeleteMessageBatchResultTypeDef
# delete_message_batch method usage example with argument unpacking
kwargs: DeleteMessageBatchRequestTypeDef = { # (1)
"QueueUrl": ...,
"Entries": ...,
}
parent.delete_message_batch(**kwargs)
delete_queue#
Deletes the queue specified by the QueueUrl, regardless of the
queue's contents.
Type annotations and code completion for session.client("sqs").delete_queue method.
boto3 documentation
# delete_queue method definition
await def delete_queue(
self,
*,
QueueUrl: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# delete_queue method usage example with argument unpacking
kwargs: DeleteQueueRequestTypeDef = { # (1)
"QueueUrl": ...,
}
parent.delete_queue(**kwargs)
get_queue_attributes#
Gets attributes for the specified queue.
Type annotations and code completion for session.client("sqs").get_queue_attributes method.
boto3 documentation
# get_queue_attributes method definition
await def get_queue_attributes(
self,
*,
QueueUrl: str,
AttributeNames: Sequence[QueueAttributeFilterType] = ..., # (1)
) -> GetQueueAttributesResultTypeDef: # (2)
...
- See
Sequence[QueueAttributeFilterType] - See GetQueueAttributesResultTypeDef
# get_queue_attributes method usage example with argument unpacking
kwargs: GetQueueAttributesRequestTypeDef = { # (1)
"QueueUrl": ...,
}
parent.get_queue_attributes(**kwargs)
get_queue_url#
The GetQueueUrl API returns the URL of an existing Amazon SQS
queue.
Type annotations and code completion for session.client("sqs").get_queue_url method.
boto3 documentation
# get_queue_url method definition
await def get_queue_url(
self,
*,
QueueName: str,
QueueOwnerAWSAccountId: str = ...,
) -> GetQueueUrlResultTypeDef: # (1)
...
# get_queue_url method usage example with argument unpacking
kwargs: GetQueueUrlRequestTypeDef = { # (1)
"QueueName": ...,
}
parent.get_queue_url(**kwargs)
list_dead_letter_source_queues#
Returns a list of your queues that have the RedrivePolicy queue
attribute configured with a dead-letter queue.
Type annotations and code completion for session.client("sqs").list_dead_letter_source_queues method.
boto3 documentation
# list_dead_letter_source_queues method definition
await def list_dead_letter_source_queues(
self,
*,
QueueUrl: str,
NextToken: str = ...,
MaxResults: int = ...,
) -> ListDeadLetterSourceQueuesResultTypeDef: # (1)
...
# list_dead_letter_source_queues method usage example with argument unpacking
kwargs: ListDeadLetterSourceQueuesRequestTypeDef = { # (1)
"QueueUrl": ...,
}
parent.list_dead_letter_source_queues(**kwargs)
list_message_move_tasks#
Gets the most recent message movement tasks (up to 10) under a specific source queue.
Type annotations and code completion for session.client("sqs").list_message_move_tasks method.
boto3 documentation
# list_message_move_tasks method definition
await def list_message_move_tasks(
self,
*,
SourceArn: str,
MaxResults: int = ...,
) -> ListMessageMoveTasksResultTypeDef: # (1)
...
# list_message_move_tasks method usage example with argument unpacking
kwargs: ListMessageMoveTasksRequestTypeDef = { # (1)
"SourceArn": ...,
}
parent.list_message_move_tasks(**kwargs)
list_queue_tags#
List all cost allocation tags added to the specified Amazon SQS queue.
Type annotations and code completion for session.client("sqs").list_queue_tags method.
boto3 documentation
# list_queue_tags method definition
await def list_queue_tags(
self,
*,
QueueUrl: str,
) -> ListQueueTagsResultTypeDef: # (1)
...
# list_queue_tags method usage example with argument unpacking
kwargs: ListQueueTagsRequestTypeDef = { # (1)
"QueueUrl": ...,
}
parent.list_queue_tags(**kwargs)
list_queues#
Returns a list of your queues in the current region.
Type annotations and code completion for session.client("sqs").list_queues method.
boto3 documentation
# list_queues method definition
await def list_queues(
self,
*,
QueueNamePrefix: str = ...,
NextToken: str = ...,
MaxResults: int = ...,
) -> ListQueuesResultTypeDef: # (1)
...
# list_queues method usage example with argument unpacking
kwargs: ListQueuesRequestTypeDef = { # (1)
"QueueNamePrefix": ...,
}
parent.list_queues(**kwargs)
purge_queue#
Deletes available messages in a queue (including in-flight messages) specified
by the QueueURL parameter.
Type annotations and code completion for session.client("sqs").purge_queue method.
boto3 documentation
# purge_queue method definition
await def purge_queue(
self,
*,
QueueUrl: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# purge_queue method usage example with argument unpacking
kwargs: PurgeQueueRequestTypeDef = { # (1)
"QueueUrl": ...,
}
parent.purge_queue(**kwargs)
receive_message#
Retrieves one or more messages (up to 10), from the specified queue.
Type annotations and code completion for session.client("sqs").receive_message method.
boto3 documentation
# receive_message method definition
await def receive_message(
self,
*,
QueueUrl: str,
AttributeNames: Sequence[QueueAttributeFilterType] = ..., # (1)
MessageSystemAttributeNames: Sequence[MessageSystemAttributeNameType] = ..., # (2)
MessageAttributeNames: Sequence[str] = ...,
MaxNumberOfMessages: int = ...,
VisibilityTimeout: int = ...,
WaitTimeSeconds: int = ...,
ReceiveRequestAttemptId: str = ...,
) -> ReceiveMessageResultTypeDef: # (3)
...
- See
Sequence[QueueAttributeFilterType] - See
Sequence[MessageSystemAttributeNameType] - See ReceiveMessageResultTypeDef
# receive_message method usage example with argument unpacking
kwargs: ReceiveMessageRequestTypeDef = { # (1)
"QueueUrl": ...,
}
parent.receive_message(**kwargs)
remove_permission#
Revokes any permissions in the queue policy that matches the specified
Label parameter.
Type annotations and code completion for session.client("sqs").remove_permission method.
boto3 documentation
# remove_permission method definition
await def remove_permission(
self,
*,
QueueUrl: str,
Label: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# remove_permission method usage example with argument unpacking
kwargs: RemovePermissionRequestTypeDef = { # (1)
"QueueUrl": ...,
"Label": ...,
}
parent.remove_permission(**kwargs)
send_message#
Delivers a message to the specified queue.
Type annotations and code completion for session.client("sqs").send_message method.
boto3 documentation
# send_message method definition
await def send_message(
self,
*,
QueueUrl: str,
MessageBody: str,
DelaySeconds: int = ...,
MessageAttributes: Mapping[str, MessageAttributeValueUnionTypeDef] = ..., # (1)
MessageSystemAttributes: Mapping[MessageSystemAttributeNameForSendsType, MessageSystemAttributeValueTypeDef] = ..., # (2)
MessageDeduplicationId: str = ...,
MessageGroupId: str = ...,
) -> SendMessageResultTypeDef: # (3)
...
- See
Mapping[str, MessageAttributeValueUnionTypeDef] - See
Mapping[Literal['AWSTraceHeader'], MessageSystemAttributeValueTypeDef] - See SendMessageResultTypeDef
# send_message method usage example with argument unpacking
kwargs: SendMessageRequestTypeDef = { # (1)
"QueueUrl": ...,
"MessageBody": ...,
}
parent.send_message(**kwargs)
send_message_batch#
You can use SendMessageBatch to send up to 10 messages to the
specified queue by assigning either identical or different values to each
message (or by not assigning values at all).
Type annotations and code completion for session.client("sqs").send_message_batch method.
boto3 documentation
# send_message_batch method definition
await def send_message_batch(
self,
*,
QueueUrl: str,
Entries: Sequence[SendMessageBatchRequestEntryTypeDef], # (1)
) -> SendMessageBatchResultTypeDef: # (2)
...
- See
Sequence[SendMessageBatchRequestEntryTypeDef] - See SendMessageBatchResultTypeDef
# send_message_batch method usage example with argument unpacking
kwargs: SendMessageBatchRequestTypeDef = { # (1)
"QueueUrl": ...,
"Entries": ...,
}
parent.send_message_batch(**kwargs)
set_queue_attributes#
Sets the value of one or more queue attributes, like a policy.
Type annotations and code completion for session.client("sqs").set_queue_attributes method.
boto3 documentation
# set_queue_attributes method definition
await def set_queue_attributes(
self,
*,
QueueUrl: str,
Attributes: Mapping[QueueAttributeNameType, str], # (1)
) -> EmptyResponseMetadataTypeDef: # (2)
...
- See
Mapping[QueueAttributeNameType, str] - See EmptyResponseMetadataTypeDef
# set_queue_attributes method usage example with argument unpacking
kwargs: SetQueueAttributesRequestTypeDef = { # (1)
"QueueUrl": ...,
"Attributes": ...,
}
parent.set_queue_attributes(**kwargs)
start_message_move_task#
Starts an asynchronous task to move messages from a specified source queue to a specified destination queue.
Type annotations and code completion for session.client("sqs").start_message_move_task method.
boto3 documentation
# start_message_move_task method definition
await def start_message_move_task(
self,
*,
SourceArn: str,
DestinationArn: str = ...,
MaxNumberOfMessagesPerSecond: int = ...,
) -> StartMessageMoveTaskResultTypeDef: # (1)
...
# start_message_move_task method usage example with argument unpacking
kwargs: StartMessageMoveTaskRequestTypeDef = { # (1)
"SourceArn": ...,
}
parent.start_message_move_task(**kwargs)
tag_queue#
Add cost allocation tags to the specified Amazon SQS queue.
Type annotations and code completion for session.client("sqs").tag_queue method.
boto3 documentation
# tag_queue method definition
await def tag_queue(
self,
*,
QueueUrl: str,
Tags: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
# tag_queue method usage example with argument unpacking
kwargs: TagQueueRequestTypeDef = { # (1)
"QueueUrl": ...,
"Tags": ...,
}
parent.tag_queue(**kwargs)
untag_queue#
Remove cost allocation tags from the specified Amazon SQS queue.
Type annotations and code completion for session.client("sqs").untag_queue method.
boto3 documentation
# untag_queue method definition
await def untag_queue(
self,
*,
QueueUrl: str,
TagKeys: Sequence[str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
# untag_queue method usage example with argument unpacking
kwargs: UntagQueueRequestTypeDef = { # (1)
"QueueUrl": ...,
"TagKeys": ...,
}
parent.untag_queue(**kwargs)
__aenter__#
Type annotations and code completion for session.client("sqs").__aenter__ method.
boto3 documentation
# __aenter__ method definition
await def __aenter__(
self,
) -> Self:
...
__aexit__#
Type annotations and code completion for session.client("sqs").__aexit__ method.
boto3 documentation
# __aexit__ method definition
await def __aexit__(
self,
exc_type: Type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: types.TracebackType | None,
) -> None:
...
get_paginator#
Type annotations and code completion for session.client("sqs").get_paginator method with overloads.
client.get_paginator("list_dead_letter_source_queues")-> ListDeadLetterSourceQueuesPaginatorclient.get_paginator("list_queues")-> ListQueuesPaginator