I have been trying to run a file named "send.py" to send a message to the queue in RabbitMQ. Whenever I try to run this file I receive a "pika.exceptions.AMQPConnectionError". I do not have RabbitMQ installed and cannot use it for this project. I have another device that has RabbitMQ installed that has to receive the message I send to queue by running a "receive.py" file. I have been informed that I need a "AMQP Library" installed but I already have "pika" installed. I am not sure how to solve this issue. Any help would be appreciated.
Here is the error:
Traceback (most recent call last):
File "/home/user/file/send.py", line 6, in <module>
connection = pika.BlockingConnection(
File "/usr/local/lib/python3.10/dist-packages/pika/adapters/blocking_connection.py", line 360, in __init__
self._impl = self._create_connection(parameters, _impl_class)
File "/usr/local/lib/python3.10/dist-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError
Here is my code for send.py:
#!/usr/bin/env python
import pika
credentials = pika.PlainCredentials(username='username', password='password')
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='ipaddress', credentials=credentials))
channel = connection.channel()
channel.queue_declare(queue='Hello')
channel.basic_publish(exchange='', routing_key='Hello', body='Hey!')
print(" [x] Sent 'Hello World!' ")
connection.close()