import pika from mini_queue.utils.config import CONFIG def put_message(parameters): connection = pika.BlockingConnection(parameters) channel = connection.channel() inp_queue = CONFIG.rabbitmq.queues.input channel.queue_declare(queue=inp_queue, durable=True) channel.basic_publish('', inp_queue, 'Hello Wald!') print(" [x] Sent something'") connection.close() if __name__ == "__main__": credentials = pika.PlainCredentials(CONFIG.rabbitmq.user, CONFIG.rabbitmq.password) parameters = pika.ConnectionParameters(host=CONFIG.rabbitmq.host, port=CONFIG.rabbitmq.port, heartbeat=CONFIG.rabbitmq.heartbeat, credentials=credentials) put_message(parameters)