How to use the queuelib.amqp function in queuelib

To help you get started, we’ve selected a few queuelib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openrightsgroup / Blocking-Middleware / backend / queue-services / cf-probe.py View on Github external
'url': url,
            'status': status,
            'network_name': self.network,
            'probe_uuid': self.cfg.get('cf-probe', 'probe_uuid'),
            'date': self.signer.timestamp(),
            'blocktype': 'PARENTAL',
            'config': -1,
            'ip_network': None,
            'http_status': None,
        }
        rsp['signature'] = self.signer.get_signature(
            args=rsp,
            keys=["probe_uuid", "url", "status", "date", "config"])

        urlhash = data.get('hash')
        msg = amqp.Message(json.dumps(rsp))
        routing_key = 'results.' + self.network + '.' + \
            (urlhash if urlhash is not None else '')
        self.ch.basic_publish(msg, self.cfg.get('cf-probe','exchange'), routing_key)

        
        time.sleep(0.1)
        return True