13 lines
516 B
Python
13 lines
516 B
Python
|
import pika
|
||
|
import sys
|
||
|
|
||
|
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
|
||
|
channel = connection.channel()
|
||
|
|
||
|
channel.queue_declare(queue='grenaderova2', durable=True)
|
||
|
|
||
|
message = ' '.join(sys.argv[1:]) or "Hello, I am Grenaderova Anastasia. I love cats."
|
||
|
channel.basic_publish(exchange='', routing_key='grenaderova2', body=message, properties=pika.BasicProperties(
|
||
|
delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE))
|
||
|
print(f" [x] Отправлено {message}")
|
||
|
connection.close()
|