changed mqtt to rabbitMQ test file
This commit is contained in:
20
source/rabbitmq_test.py
Normal file
20
source/rabbitmq_test.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import pika
|
||||
import ssl
|
||||
|
||||
print
|
||||
|
||||
context = ssl.create_default_context()
|
||||
context.verify_mode = ssl.CERT_REQUIRED
|
||||
|
||||
ssl_options= pika.SSLOptions(context=context, server_hostname="rabbitmq.deowl.ru")
|
||||
|
||||
credential = pika.PlainCredentials("admin", "admin")
|
||||
|
||||
try:
|
||||
connection = pika.BlockingConnection(pika.ConnectionParameters('rabbitmq.deowl.ru', virtual_host='/', port=5671, ssl_options=ssl_options, credentials=credential))
|
||||
channel = connection.channel()
|
||||
print("good")
|
||||
except pika.exceptions.AMQPConnectionError as e:
|
||||
print(f"Connection error: {e}")
|
||||
except Exception as e:
|
||||
print(f"An unexpected error occurred: {e}")
|
||||
Reference in New Issue
Block a user