我正在使用以下代碼與labeeb-iot broker連接。Python 3.6 SSL:CERTIFICATE_VERIFY_FAILED
import paho.mqtt.client as mqtt
import ssl
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("/focus/temp/SEnsor1/Model1/Temperature/data")
def on_message(client, userdata, msg):
print(msg.payload.decode())
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.tls_set("/etc/ssl/certs/ca-certificates.crt", certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED,tls_version=ssl.PROTOCOL_TLSv1_2, ciphers=None)
client.tls_insecure_set(False)
client.connect("mea.labeeb-iot.com",8883,60)
client.loop_forever()
下面的代碼執行後的結果是:
我使用Linux Manjaro( ArchLiux) –
請閱讀關於提出好問題的文檔,因爲它代表了這個問題應該被關閉,因爲它只是一個代碼清單和「這是中斷的」問題,通常被認爲是脫離主題。 https://stackoverflow.com/help/how-to-ask – hardillb
同樣作爲一個規則,MQTT主題不應該以一個前導'/'開頭,因爲這隻會在主題樹的開頭添加一個空元素。 – hardillb