20 lines
629 B
Python
20 lines
629 B
Python
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}") |