kylebebak / Requester

Powerful, modern HTTP/REST client built on top of the Requests library
https://kylebebak.github.io/Requester/
MIT License
307 stars 10 forks source link

Connection Error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:548) #17

Closed jlab13 closed 5 years ago

jlab13 commented 6 years ago

How to use Self-signed SSL certificates?

I think maybe need add setting for use Session.merge_environment_settings?

kylebebak commented 6 years ago

Hey!

I've never used Requests with a self-signed certificate, but you're right -- it looks like it should be possible using prepared requests.

Requester's parser previously didn't support prepared requests, but I just pushed a new version that fixes that. To use a session, you can just instantiate it in your env block and then reference it outside of the env block.

###env
import requests
import os
os.environ['REQUESTS_CA_BUNDLE'] = 'blablabla'

s = requests.Session()
req = requests.Request('GET', 'https://www.google.com')

prepped = s.prepare_request(req)

# Merge environment settings into session
settings = s.merge_environment_settings(prepped.url, None, None, None, None)
###env

s.send(prepped, **settings)

Go ahead and try something like this, and see if you can get it working!

kylebebak commented 5 years ago

@jlab13

Did you get a chance to try this?