A simple Amazon SQS consumer library.
Squishy is a simple Amazon SQS consumer for Python. Many versions of Python are (or will be) supported.
This is currently alpha software! It works under basic testing but does not yet have a full battery of automated tests. Use at your own risk!
Currently, you have to clone the repo and install the hard way. This will change soon.
- Clone the repo.
- Install the requirements. If you want to use the futures workers on Python 2, be sure to install futures.
- python setup.py install
Squishy provides a CLI to run a worker that will dispatch messages to a callback you define. The callback should accept a single parameter representing a single message consumed from an SQS queue.
# my_consumer.py def my_callback(message): print('Got a message! Contents:', message)
Then on the command line:
$ squishy run_consumer https://sqs.us-east-1.amazonaws.com/12345/my_queue my_consumer:my_callback
Squishy uses boto3, which will automatically load credentials from $HOME/.aws/credentials. If you need more control over authentication, you can give Squishy a factory function for creating a custom session.
$ squishy --help Usage: squishy [OPTIONS] COMMAND [ARGS]... Options: --log-level [debug|info|warning|error|critical] Logging level. --botocore-log-level [debug|info|warning|error|critical] botocore logging level. --version Show the version and exit. --help Show this message and exit. Commands: run_consumer $ squishy run_consumer --help Usage: squishy run_consumer [OPTIONS] QUEUE_URL CALLBACK Options: --session-factory TEXT Factory function for a custom boto3.Session. -c, --concurrency INTEGER Worker concurrency. -m, --polling-method [long|short] Polling method. -t, --polling-timeout INTEGER Polling interval in seconds. -n, --polling-count INTEGER Number of messages to fetch when polling. -w, --worker-class [futures_process|futures_thread|gevent|mp_process|mp_thread] Worker class. --help Show this message and exit.
Bugfixes (Alejandro Mesa): * Bug fix related to relative imports for modules that have the same name as a package. * Missing import for gevent.monkey * Bug with passing the message to the worker process without unpacking the dictionary * Bug fix to handle keyboard interrupts. * Bug fix with deleting keys from the results_to_message list while iterating through the list.
- Switched to RST to be PyPI-friendly.
- First release.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|squishy-0.0.3-py3-none-any.whl (12.8 kB) Copy SHA256 hash SHA256||Wheel||py3||Jul 1, 2016|
|squishy-0.0.3.tar.gz (9.1 kB) Copy SHA256 hash SHA256||Source||None||Jul 1, 2016|