import certstream import redis import sys r = redis.Redis() def enqueue(message, context): for domain in message['data']['leaf_cert']['all_domains']: r.rpush('certstream', domain) certstream.listen_for_events(enqueue, url='wss://certstream.calidog.io/')