Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL errors when testing certain HTTPS sites #417

Closed
sr-murthy opened this issue May 13, 2016 · 6 comments
Closed

SSL errors when testing certain HTTPS sites #417

sr-murthy opened this issue May 13, 2016 · 6 comments

Comments

@sr-murthy
Copy link

I'm getting SSL errors sometimes when using certain HTTPS sites using locust:

In [26]: u
Out[26]: <locust.core.HttpLocust at 0x104f94cd0>

In [27]: u.host
Out[27]: 'https://www.dodopal.com'

In [28]: res = u.client.get('/'); res.__dict__
Out[28]: 
{'_content': None,
 '_content_consumed': True,
 'cookies': <RequestsCookieJar[]>,
 'elapsed': datetime.timedelta(0),
 'encoding': None,
 'error': requests.exceptions.SSLError(requests.packages.urllib3.exceptions.SSLError(ssl.SSLError(1,
                                                                                         u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'))),
 'headers': {},
 'history': [],
 'raw': None,
 'reason': None,
 'request': <PreparedRequest [GET]>,
 'status_code': 0,
 'url': None}

Other sites seem to be fine:

In [35]: u.host = 'https://www.eff.org'

In [36]: u.client.get('/')
Out[36]: <Response [200]>
@sr-murthy sr-murthy changed the title SSL errors when accessing certain HTTPS sites SSL errors when testing certain HTTPS sites May 13, 2016
@sr-murthy
Copy link
Author

sr-murthy commented May 13, 2016

This could be related to this issue, but the suggested solution is not practical because it means modifying requests code inside locust source.

@dlai0001
Copy link

This is the hackish workaround I'm using. I put this in my task set definition, so it'll run when the TaskSet is loaded.

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

Perhaps it can be added to the code base that spawns the threads.

@Anup-Deo21
Copy link

How to get rid from “SSL: CERTIFICATE_VERIFY_FAILED” Error

On Windows, Python does not look at the system certificate, it uses its own located at ?\lib\site-packages\certifi\cacert.pem.

The solution to your problem:

  1. download the domain validation certificate as *.crt or *pem file
  2. open the file in editor and copy it's content to clipboard
  3. find your cacert.pem location: from requests.utils import DEFAULT_CA_BUNDLE_PATH; print(DEFAULT_CA_BUNDLE_PATH)
  4. edit the cacert.pem file and paste your domain validation certificate at the end of the file.
  5. Save the file and enjoy requests!

@lyenliang
Copy link

possible duplicate of #300

@mjohnson767
Copy link

I'm not sure what this means: "paste your domain validation certificate at the end of the file". When I open my domain.crt up in notepad it's all encrypted.
0‚��0‚�� ������]�º–l
á“GèaÜ.
That's what I'd be adding to the locust pem file. Can I get some clarification on this?

@stephen-dahl
Copy link

stephen-dahl commented Apr 19, 2022

appending my ca to DEFAULT_CA_BUNDLE_PATH worked in docker on rhel also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants