boogio.sqs_sifter module

Manage retrieval and handling of messages from an AWS SQS queue.

class boogio.sqs_sifter.SQSSifter(queue_url, profile_name=None, region_name='us-east-1', connect=True, filters=None)[source]

Bases: object

AWS SQS queue message receiver and handler selector.

connect(profile_name=None, region_name=None, reconnect=True)[source]

Connect an AWS session and create an SQS client.

Parameters:
  • profile_name (str) – Session parameter for the AWS connection.
  • region_name (str) – Session parameter for the AWS connection.
  • reconnect (bool) – If True, an existing session and client will be replaced with a new pair. If False, a new session and client will only be created if none already exists.
sift_for_message(delete_scree=False, **kwargs)[source]

Receive and return sifted messages from the Queue.

Parameters:
  • delete_scree (bool) – If True, messages that don’t match the sifter’s filters will be deleted from the SQS queue.
  • kwargs – Additional parameters to pass through to the sqs client receive_message() call.
Returns:

A list of the messages received from the queue that passed the sifter’s filters.

Return type:

(list)