Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL error CERTIFICATE_VERIFY_FAILED with Locust when using Docker

Tags:

python

locust

It's my first try at Locus, and unfortunately I don't know Python.

I'm trying a simple request to a valid https server, and I see this error:

SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

After some research I tried to add this:

import gevent
import geventhttpclient.connectionpool

geventhttpclient.connectionpool.SSLConnectionPool.default_options = {
    "cert_reqs": gevent.ssl.CERT_NONE,
}

or this:

import requests
requests.packages.urllib3.disable_warnings() # disable SSL warnings

I run Locust as instructed:

docker-compose up --scale worker=4

How can I test https sites with Locust?

Thanks in advance

Regards

like image 451
greg Avatar asked May 16 '26 09:05

greg


1 Answers

You can do turn the verification off by adding below method:

def on_start(self):
    """ on_start is called when a Locust start before any task is scheduled """
    self.client.verify = False
like image 192
Saikat Avatar answered May 17 '26 23:05

Saikat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!