@contextmanager
    def connection(self):
        conn = amqp.Connection(
            host="%s:%s" % (self.config.RABBIT_HOST, self.config.RABBIT_PORT),
            userid=self.config.RABBIT_USER,
            password=self.config.RABBIT_PASSWORD,
            virtual_host=self.config.RABBIT_VIRTUAL_HOST)
        logger.info('Connected to RabbitMQ')
        with closing(conn):
            yield conn
Returns a new connection as a context manager.
dataset/ETHPy150Open cenk/kuyruk/kuyruk/__init__.py/Kuyruk.connection