Skip to content

Is it possible to provide a python example using pika and SSL #5

Description

@drivard

Hi,

It would be really appreciated to get the example of a working connection using the amqps scheme.
I am currently trying to achieve that using the pika library but I always get the error:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

I cannot tell if it is related to the Comodo CA or the OS lacking the intermediate CA or any of the usual ssl issues, since I tried many combinaisons as well as downloading the intermediate CA cert from comodo to ensure that it is known by my OS.

The connection sample I used is:

import pika
import ssl

credentials = pika.credentials.PlainCredentials(username='****', password='*****')
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
context.verify_mode = ssl.CERT_OPTIONAL  # also tried CERT_REQUIRED
parameters = pika.ConnectionParameters(
    host='*****.****.cloudamqp.com',
    port=5671,
    virtual_host='my-vhost',
    credentials=credentials,
    ssl_options=pika.SSLOptions(context)
)
connection = pika.BlockingConnection(parameters)

I am using python from mac os catalina and I used brew to install python.
Python 3.7.5 in an isolated virtualenv with only pika installed.
pika==1.1.0

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions