Listen to and inspect AWS SNS topic data
Project description
snifter
Listen to and inspect AWS SNS topic data!
Because SNS data is ephemeral, we need to make a place to receive and store the data if we want to inspect it. While you can subscribe your email address, it’s not very handy to do so (SMS is obviously not better). A clean (if slightly over-complex) method for doing this is to create a temporary SQS queue, then subscribe the queue to the SNS topic you want to inspect, and then watch that queue.
Snifter does all that in a single command. The queue is build and torn down for you, and it will endlessly listen to that queue, including dropping into an interactive debug session that will let you inspect the payload in detail.
Provide a profile and a topic, the queue will be torn down when it catches Ctrl+c
Basic Usage
$ snifter --profile=dev-power --topic=tim-manager-events
Listening...
Listening...
^CListening...
Deleted queue with URL https://us-west-2.queue.amazonaws.com/024726604032/sns-listener_tim-manager-events_88fc71e98a.
Debug Usage
Providing the –debug flag will cause you to drop into a debugger when something is popped from the queue, PDB behavior applies. The payload of the SNS message (‘Message’) is assigned a namespace (‘m’). This means that you get tab completion on the dynamic keys in your message payload.
Help
$ snifter --help
usage: snifter [-h] [-p PROFILE] [-d] [-t TOPIC]
Listen to an SNS topic
optional arguments:
-h, --help show this help message and exit
-p PROFILE, --profile PROFILE
AWS profile name
-d, --debug Drop into debugger to inspect message
-t TOPIC, --topic TOPIC
SNS topic name
Login
Listening
Inspecting (with debug on)
$ snifter --profile=dev-power --topic=tim-manager-events --debug
Listening...
Listening...
Attempting decode of body
Dropping into debugger for inspection
Local message namespace is 'm'
PDB commands: 'c' to continue, 'exit()' to exit
[2] > /home/ahonnecke/src/snifter/src/snifter/main.py(161)listen()
-> message.delete()
(Pdb++) list
156 print("PDB commands: 'c' to continue, 'exit()' to exit")
157 breakpoint()
158 else:
159 print(f"Recieved message, {show}")
160
161 -> message.delete()
162
163 print("Listening...")
164 sleep(1)
165
166
(Pdb++) print(m.curve_angle)
None
(Pdb++) print(m.failed_rsu_ids)
['590d0953-444d-4f0a-842d-3ad425394baf', '8bfacac8-9c8f-41e6-b9a3-09641913da8a', 'd4d7cc04-b98a-4ad8-b9b6-801966c84f68', 'e7e259da-926c-4c0e-93cd-a8507bda76b3']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file snifter-0.0.19.tar.gz
.
File metadata
- Download URL: snifter-0.0.19.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a663fb98bacbdcc5f0b532f39c5e2ff3dcbda3000b648cfb08abcb7522c225c |
|
MD5 | cc3c7bb8ceb027e323100ba696b12924 |
|
BLAKE2b-256 | 3883255bc8ed8a02e88b9d9ff12b9b82f1200a75d36d0a27a64394c8f6a47b2a |
File details
Details for the file snifter-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: snifter-0.0.19-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b21e5814850a3205b7bb8f02ebe4ba12b1bc9fc427c9202d4fffe51ad282f556 |
|
MD5 | 37b908273d31509e6745c990cd52a515 |
|
BLAKE2b-256 | f9e8fe8eef202adb595d2d9c2d5683f05fff7132719f0dc9b0dae0e6c0b12f78 |