Pika使用SSL连接,无证书fi

2024-04-25 20:15:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用pika使用SSL(自签名)连接到RabbitMQ。在

问题是如果我不把证书文件给pika,连接就不会失败。在

这是我的代码:

import pika
import urllib

connection = pika.BlockingConnection(pika.URLParameters("amqps://guest:guest@172.16.120.130:25585"))
channel = connection.channel()

channel.queue_declare(queue='hello')
channel.basic_publish(exchange='',
                      routing_key='hello',
                      body='Hello World!')

print(" [x] Sent 'Hello World!'")
connection.close()

这是我的rabbitmq.config文件公司名称:

^{pr2}$

我已经禁用了TCP连接并启用了SSL,为什么连接没有失败?在


Tags: 文件代码importsslhelloworldqueuechannel