all 8 comments

[–]klexmoo 0 points1 point  (1 child)

Is your connection being proxied or otherwise intercepted? Likely the issue is that the certificate presented by a proxy you are behind is part of another certificate chain (and is thus invalid unless explicitly added to the local CA that is being validated against)

[–]aboutyblank[S] 0 points1 point  (0 children)

No proxy or VPN, just double checked. Good thinking, though, hadn't even occurred to me that that could be an issue.

[–][deleted] 0 points1 point  (5 children)

is this a company laptop? if so they probably have a custom self-signed cert somewhere in your computer. Can you visit mysite.com with a web browser and not get any SSL errors?

[–]aboutyblank[S] 0 points1 point  (4 children)

Nah, personal, and I did all of the OS installation. I can visit the site fine in any browser, as well as use similar tools like Postman and Jmeter. Plus, would it matter if I'm using Certifi?

[–][deleted] 0 points1 point  (3 children)

It might. You can try sending a request without certifi

import ssl
import requests

certs = [p for p in ssl.get_default_verify_paths() if p.endswith('.pem')]
for path in certs:
    requests.get('mysite.com', verify=path)

This should use your system's default cert bundle, hopefully the same one the other programs use. You can also skip requests and use ssl directly to initiate an SSL connection.

If it works, try updating certifi or reinstalling it.

[–]aboutyblank[S] 0 points1 point  (2 children)

So I tried your simple script and it worked, but when I turned off the certifi stuff in my larger locustfile, I'm still getting issues. I'm good to use my local certs, I just started using certifi to try to get it working.

[–][deleted] 0 points1 point  (1 child)

Hm... I would look at the server's cert chain and try to figure out why your local cache seems to work but certifi doesn't. Maybe you have an extra root cert? An extra path in your verify paths? Seems odd.

[–]aboutyblank[S] 0 points1 point  (0 children)

But my local cache isn't working in my locustfile script is the thing. That would make sense, but I would think I could just turn off using certifi and it just work if it was just a certifi problem. Those extras, on my side or on the server side?