Skip to content

SQSClient

Index > SQS > SQSClient

Auto-generated documentation for SQS type annotations stubs module mypy-boto3-sqs.

SQSClient

Type annotations and code completion for boto3.client("sqs"). boto3 documentation

Usage example
from boto3.session import Session
from mypy_boto3_sqs.client import SQSClient

def get_sqs_client() -> SQSClient:
    return Session().client("sqs")

Exceptions

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("sqs").exceptions structure.

Usage example
client = boto3.client("sqs")

try:
    do_something(client)
except (
    client.BatchEntryIdsNotDistinct,
    client.BatchRequestTooLong,
    client.ClientError,
    client.EmptyBatchRequest,
    client.InvalidAttributeName,
    client.InvalidBatchEntryId,
    client.InvalidIdFormat,
    client.InvalidMessageContents,
    client.MessageNotInflight,
    client.OverLimit,
    client.PurgeQueueInProgress,
    client.QueueDeletedRecently,
    client.QueueDoesNotExist,
    client.QueueNameExists,
    client.ReceiptHandleIsInvalid,
    client.TooManyEntriesInBatchRequest,
    client.UnsupportedOperation,
) as e:
    print(e)
Type checking example
from mypy_boto3_sqs.client import Exceptions

def handle_error(exc: Exceptions.BatchEntryIdsNotDistinct) -> None:
    ...

Methods

add_permission

Adds a permission to a queue for a specific principal_.

Type annotations and code completion for boto3.client("sqs").add_permission method. boto3 documentation

Method definition
def add_permission(
    self,
    *,
    QueueUrl: str,
    Label: str,
    AWSAccountIds: Sequence[str],
    Actions: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: AddPermissionRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Label": ...,
    "AWSAccountIds": ...,
    "Actions": ...,
}

parent.add_permission(**kwargs)
  1. See AddPermissionRequestRequestTypeDef

can_paginate

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("sqs").can_paginate method. boto3 documentation

Method definition
def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

change_message_visibility

Changes the visibility timeout of a specified message in a queue to a new value.

Type annotations and code completion for boto3.client("sqs").change_message_visibility method. boto3 documentation

Method definition
def change_message_visibility(
    self,
    *,
    QueueUrl: str,
    ReceiptHandle: str,
    VisibilityTimeout: int,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: ChangeMessageVisibilityRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "ReceiptHandle": ...,
    "VisibilityTimeout": ...,
}

parent.change_message_visibility(**kwargs)
  1. See ChangeMessageVisibilityRequestRequestTypeDef

change_message_visibility_batch

Changes the visibility timeout of multiple messages.

Type annotations and code completion for boto3.client("sqs").change_message_visibility_batch method. boto3 documentation

Method definition
def change_message_visibility_batch(
    self,
    *,
    QueueUrl: str,
    Entries: Sequence[ChangeMessageVisibilityBatchRequestEntryTypeDef],  # (1)
) -> ChangeMessageVisibilityBatchResultTypeDef:  # (2)
    ...
  1. See ChangeMessageVisibilityBatchRequestEntryTypeDef
  2. See ChangeMessageVisibilityBatchResultTypeDef
Usage example with kwargs
kwargs: ChangeMessageVisibilityBatchRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Entries": ...,
}

parent.change_message_visibility_batch(**kwargs)
  1. See ChangeMessageVisibilityBatchRequestRequestTypeDef

close

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("sqs").close method. boto3 documentation

Method definition
def close(
    self,
) -> None:
    ...

create_queue

Creates a new standard or FIFO queue.

Type annotations and code completion for boto3.client("sqs").create_queue method. boto3 documentation

Method definition
def create_queue(
    self,
    *,
    QueueName: str,
    Attributes: Mapping[QueueAttributeNameType, str] = ...,  # (1)
    tags: Mapping[str, str] = ...,
) -> CreateQueueResultTypeDef:  # (2)
    ...
  1. See QueueAttributeNameType
  2. See CreateQueueResultTypeDef
Usage example with kwargs
kwargs: CreateQueueRequestRequestTypeDef = {  # (1)
    "QueueName": ...,
}

parent.create_queue(**kwargs)
  1. See CreateQueueRequestRequestTypeDef

delete_message

Deletes the specified message from the specified queue.

Type annotations and code completion for boto3.client("sqs").delete_message method. boto3 documentation

Method definition
def delete_message(
    self,
    *,
    QueueUrl: str,
    ReceiptHandle: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: DeleteMessageRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "ReceiptHandle": ...,
}

parent.delete_message(**kwargs)
  1. See DeleteMessageRequestRequestTypeDef

delete_message_batch

Deletes up to ten messages from the specified queue.

Type annotations and code completion for boto3.client("sqs").delete_message_batch method. boto3 documentation

Method definition
def delete_message_batch(
    self,
    *,
    QueueUrl: str,
    Entries: Sequence[DeleteMessageBatchRequestEntryTypeDef],  # (1)
) -> DeleteMessageBatchResultTypeDef:  # (2)
    ...
  1. See DeleteMessageBatchRequestEntryTypeDef
  2. See DeleteMessageBatchResultTypeDef
Usage example with kwargs
kwargs: DeleteMessageBatchRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Entries": ...,
}

parent.delete_message_batch(**kwargs)
  1. See DeleteMessageBatchRequestRequestTypeDef

delete_queue

Deletes the queue specified by the QueueUrl , regardless of the queue's contents.

Type annotations and code completion for boto3.client("sqs").delete_queue method. boto3 documentation

Method definition
def delete_queue(
    self,
    *,
    QueueUrl: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: DeleteQueueRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
}

parent.delete_queue(**kwargs)
  1. See DeleteQueueRequestRequestTypeDef

generate_presigned_url

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("sqs").generate_presigned_url method. boto3 documentation

Method definition
def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

get_queue_attributes

Gets attributes for the specified queue.

Type annotations and code completion for boto3.client("sqs").get_queue_attributes method. boto3 documentation

Method definition
def get_queue_attributes(
    self,
    *,
    QueueUrl: str,
    AttributeNames: Sequence[QueueAttributeFilterType] = ...,  # (1)
) -> GetQueueAttributesResultTypeDef:  # (2)
    ...
  1. See QueueAttributeFilterType
  2. See GetQueueAttributesResultTypeDef
Usage example with kwargs
kwargs: GetQueueAttributesRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
}

parent.get_queue_attributes(**kwargs)
  1. See GetQueueAttributesRequestRequestTypeDef

get_queue_url

Returns the URL of an existing Amazon SQS queue.

Type annotations and code completion for boto3.client("sqs").get_queue_url method. boto3 documentation

Method definition
def get_queue_url(
    self,
    *,
    QueueName: str,
    QueueOwnerAWSAccountId: str = ...,
) -> GetQueueUrlResultTypeDef:  # (1)
    ...
  1. See GetQueueUrlResultTypeDef
Usage example with kwargs
kwargs: GetQueueUrlRequestRequestTypeDef = {  # (1)
    "QueueName": ...,
}

parent.get_queue_url(**kwargs)
  1. See GetQueueUrlRequestRequestTypeDef

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 boto3.client("sqs").list_dead_letter_source_queues method. boto3 documentation

Method definition
def list_dead_letter_source_queues(
    self,
    *,
    QueueUrl: str,
    NextToken: str = ...,
    MaxResults: int = ...,
) -> ListDeadLetterSourceQueuesResultTypeDef:  # (1)
    ...
  1. See ListDeadLetterSourceQueuesResultTypeDef
Usage example with kwargs
kwargs: ListDeadLetterSourceQueuesRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
}

parent.list_dead_letter_source_queues(**kwargs)
  1. See ListDeadLetterSourceQueuesRequestRequestTypeDef

list_queue_tags

List all cost allocation tags added to the specified Amazon SQS queue.

Type annotations and code completion for boto3.client("sqs").list_queue_tags method. boto3 documentation

Method definition
def list_queue_tags(
    self,
    *,
    QueueUrl: str,
) -> ListQueueTagsResultTypeDef:  # (1)
    ...
  1. See ListQueueTagsResultTypeDef
Usage example with kwargs
kwargs: ListQueueTagsRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
}

parent.list_queue_tags(**kwargs)
  1. See ListQueueTagsRequestRequestTypeDef

list_queues

Returns a list of your queues in the current region.

Type annotations and code completion for boto3.client("sqs").list_queues method. boto3 documentation

Method definition
def list_queues(
    self,
    *,
    QueueNamePrefix: str = ...,
    NextToken: str = ...,
    MaxResults: int = ...,
) -> ListQueuesResultTypeDef:  # (1)
    ...
  1. See ListQueuesResultTypeDef
Usage example with kwargs
kwargs: ListQueuesRequestRequestTypeDef = {  # (1)
    "QueueNamePrefix": ...,
}

parent.list_queues(**kwargs)
  1. See ListQueuesRequestRequestTypeDef

purge_queue

Deletes the messages in a queue specified by the QueueURL parameter.

Type annotations and code completion for boto3.client("sqs").purge_queue method. boto3 documentation

Method definition
def purge_queue(
    self,
    *,
    QueueUrl: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: PurgeQueueRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
}

parent.purge_queue(**kwargs)
  1. See PurgeQueueRequestRequestTypeDef

receive_message

Retrieves one or more messages (up to 10), from the specified queue.

Type annotations and code completion for boto3.client("sqs").receive_message method. boto3 documentation

Method definition
def receive_message(
    self,
    *,
    QueueUrl: str,
    AttributeNames: Sequence[QueueAttributeFilterType] = ...,  # (1)
    MessageAttributeNames: Sequence[str] = ...,
    MaxNumberOfMessages: int = ...,
    VisibilityTimeout: int = ...,
    WaitTimeSeconds: int = ...,
    ReceiveRequestAttemptId: str = ...,
) -> ReceiveMessageResultTypeDef:  # (2)
    ...
  1. See QueueAttributeFilterType
  2. See ReceiveMessageResultTypeDef
Usage example with kwargs
kwargs: ReceiveMessageRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
}

parent.receive_message(**kwargs)
  1. See ReceiveMessageRequestRequestTypeDef

remove_permission

Revokes any permissions in the queue policy that matches the specified Label parameter.

Type annotations and code completion for boto3.client("sqs").remove_permission method. boto3 documentation

Method definition
def remove_permission(
    self,
    *,
    QueueUrl: str,
    Label: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: RemovePermissionRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Label": ...,
}

parent.remove_permission(**kwargs)
  1. See RemovePermissionRequestRequestTypeDef

send_message

Delivers a message to the specified queue.

Type annotations and code completion for boto3.client("sqs").send_message method. boto3 documentation

Method definition
def send_message(
    self,
    *,
    QueueUrl: str,
    MessageBody: str,
    DelaySeconds: int = ...,
    MessageAttributes: Mapping[str, MessageAttributeValueTypeDef] = ...,  # (1)
    MessageSystemAttributes: Mapping[MessageSystemAttributeNameForSendsType, MessageSystemAttributeValueTypeDef] = ...,  # (2)
    MessageDeduplicationId: str = ...,
    MessageGroupId: str = ...,
) -> SendMessageResultTypeDef:  # (3)
    ...
  1. See MessageAttributeValueTypeDef
  2. See MessageSystemAttributeNameForSendsType MessageSystemAttributeValueTypeDef
  3. See SendMessageResultTypeDef
Usage example with kwargs
kwargs: SendMessageRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "MessageBody": ...,
}

parent.send_message(**kwargs)
  1. See SendMessageRequestRequestTypeDef

send_message_batch

Delivers up to ten messages to the specified queue.

Type annotations and code completion for boto3.client("sqs").send_message_batch method. boto3 documentation

Method definition
def send_message_batch(
    self,
    *,
    QueueUrl: str,
    Entries: Sequence[SendMessageBatchRequestEntryTypeDef],  # (1)
) -> SendMessageBatchResultTypeDef:  # (2)
    ...
  1. See SendMessageBatchRequestEntryTypeDef
  2. See SendMessageBatchResultTypeDef
Usage example with kwargs
kwargs: SendMessageBatchRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Entries": ...,
}

parent.send_message_batch(**kwargs)
  1. See SendMessageBatchRequestRequestTypeDef

set_queue_attributes

Sets the value of one or more queue attributes.

Type annotations and code completion for boto3.client("sqs").set_queue_attributes method. boto3 documentation

Method definition
def set_queue_attributes(
    self,
    *,
    QueueUrl: str,
    Attributes: Mapping[QueueAttributeNameType, str],  # (1)
) -> EmptyResponseMetadataTypeDef:  # (2)
    ...
  1. See QueueAttributeNameType
  2. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: SetQueueAttributesRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Attributes": ...,
}

parent.set_queue_attributes(**kwargs)
  1. See SetQueueAttributesRequestRequestTypeDef

tag_queue

Add cost allocation tags to the specified Amazon SQS queue.

Type annotations and code completion for boto3.client("sqs").tag_queue method. boto3 documentation

Method definition
def tag_queue(
    self,
    *,
    QueueUrl: str,
    Tags: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: TagQueueRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "Tags": ...,
}

parent.tag_queue(**kwargs)
  1. See TagQueueRequestRequestTypeDef

untag_queue

Remove cost allocation tags from the specified Amazon SQS queue.

Type annotations and code completion for boto3.client("sqs").untag_queue method. boto3 documentation

Method definition
def untag_queue(
    self,
    *,
    QueueUrl: str,
    TagKeys: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: UntagQueueRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "TagKeys": ...,
}

parent.untag_queue(**kwargs)
  1. See UntagQueueRequestRequestTypeDef

get_paginator

Type annotations and code completion for boto3.client("sqs").get_paginator method with overloads.