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

# SQSClient 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.

# Exceptions.exceptions usage example

client = boto3.client("sqs")

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)
# Exceptions.exceptions 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

# add_permission method definition

def add_permission(
    self,
    *,
    QueueUrl: str,
    Label: str,
    AWSAccountIds: Sequence[str],
    Actions: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# add_permission method usage example with argument unpacking

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

# can_paginate method definition

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

cancel_message_move_task#

Cancels a specified message movement task.

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

# cancel_message_move_task method definition

def cancel_message_move_task(
    self,
    *,
    TaskHandle: str,
) -> CancelMessageMoveTaskResultTypeDef:  # (1)
    ...
  1. See CancelMessageMoveTaskResultTypeDef
# cancel_message_move_task method usage example with argument unpacking

kwargs: CancelMessageMoveTaskRequestRequestTypeDef = {  # (1)
    "TaskHandle": ...,
}

parent.cancel_message_move_task(**kwargs)
  1. See CancelMessageMoveTaskRequestRequestTypeDef

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

# change_message_visibility method definition

def change_message_visibility(
    self,
    *,
    QueueUrl: str,
    ReceiptHandle: str,
    VisibilityTimeout: int,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# change_message_visibility method usage example with argument unpacking

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

# change_message_visibility_batch method definition

def change_message_visibility_batch(
    self,
    *,
    QueueUrl: str,
    Entries: Sequence[ChangeMessageVisibilityBatchRequestEntryTypeDef],  # (1)
) -> ChangeMessageVisibilityBatchResultTypeDef:  # (2)
    ...
  1. See ChangeMessageVisibilityBatchRequestEntryTypeDef
  2. See ChangeMessageVisibilityBatchResultTypeDef
# change_message_visibility_batch method usage example with argument unpacking

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

# close 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

# create_queue 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
# create_queue method usage example with argument unpacking

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

# delete_message method definition

def delete_message(
    self,
    *,
    QueueUrl: str,
    ReceiptHandle: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_message method usage example with argument unpacking

kwargs: DeleteMessageRequestRequestTypeDef = {  # (1)
    "QueueUrl": ...,
    "ReceiptHandle": ...,
}

parent.delete_message(**kwargs)
  1. See