1

I'm using a proxy which has self-signed SSL certificate. curl has a --proxy-insecure option which not check ssl of proxy for validation.

curl -x https://some.proxy.com --proxy-insecure  -I  https://www.somewebsite.now

I want to covert my code in python, so is there any substitution for --proxy-insecure in python?

Hedeesa
  • 148
  • 1
  • 12
  • How are you planning to make the request in Python? Using the `requests` library? Using the built in urllib library? Have you tried either to see if they care about the validity of the self-signed certificate already? Get the problem first, then ask how to fix it :-) – MatsLindh Apr 05 '20 at 21:27
  • @MatsLindh I'm manipulating this app [link] (https://github.com/sivel/speedtest-cli) and it's using urllib2. I want to know how I can use my self-signed proxy in this app. – Hedeesa Apr 05 '20 at 21:37
  • See https://stackoverflow.com/questions/1450132/proxy-with-urllib2 - you might also be able to set it using environment variables (i.e. `export` under nix, `set` under windows) and setting `https_proxy` to the proxy host. – MatsLindh Apr 06 '20 at 08:16
  • You may take adavantage from [Python: Ignore certificate validation](https://stackoverflow.com/questions/19268548/). – U880D Apr 07 '20 at 00:04
  • Does this answer your question? [python ignore certificate validation urllib2](https://stackoverflow.com/questions/19268548/python-ignore-certificate-validation-urllib2) – U880D Apr 07 '20 at 00:05
  • @U880D unfortunately no. in your answer actually the ssl of the website is not going to be checked, although I want that the ssl of my proxy dont be checked – Hedeesa Apr 07 '20 at 03:00

1 Answers1

-1

with requests:

pip3 install requests

and then:

import requests
requests.get('https://www.somewebsite.now', proxies={'https': 'https://some.proxy.com'}, verify=False)