Skip to content

Instantly share code, notes, and snippets.

@techman83
Last active June 23, 2019 08:35
Show Gist options
  • Save techman83/0604f4dc9f849aac605e46f494de9403 to your computer and use it in GitHub Desktop.
Save techman83/0604f4dc9f849aac605e46f494de9403 to your computer and use it in GitHub Desktop.
Minimal Python3 script to Submit a Netkan file to an Inbound Queue
import boto3
import sys
from hashlib import md5
filename = sys.argv[1]
if not filename:
print('/path/to/Mod.netkan required')
sys.exit()
sqs = boto3.resource('sqs')
queue = sqs.get_queue_by_name(QueueName='InboundDev.fifo')
with open(filename, 'r') as netkan:
content = netkan.read()
queue.send_message(MessageBody=content, MessageGroupId='1', MessageDeduplicationId=md5(content.encode()).hexdigest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment