[tor-commits] [sbws/master] destination: disable urllib3 warnings

juga at torproject.org juga at torproject.org
Fri Feb 15 17:40:52 UTC 2019


commit 4761f06765d03367803b38b4fd77535067bddec9
Author: juga0 <juga at riseup.net>
Date:   Sat Dec 8 16:38:45 2018 +0000

    destination: disable urllib3 warnings
    
    when disabling destination certificate validation.
---
 sbws/lib/destination.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sbws/lib/destination.py b/sbws/lib/destination.py
index 94622ff..02f56c9 100644
--- a/sbws/lib/destination.py
+++ b/sbws/lib/destination.py
@@ -18,7 +18,7 @@ def _parse_verify_option(conf_section):
     if 'verify' not in conf_section:
         return DESTINATION_VERIFY_CERTIFICATE
     try:
-        return conf_section.getboolean('verify')
+        verify = conf_section.getboolean('verify')
     except ValueError:
         log.warning(
             'Currently sbws only supports verify=true/false, not a CA bundle '
@@ -28,6 +28,11 @@ def _parse_verify_option(conf_section):
             'of testing. So we will allow this, but expect Requests to throw '
             'SSLError exceptions later. Have fun!', conf_section['verify'])
         return conf_section['verify']
+    if not verify:
+        # disable urllib3 warning: InsecureRequestWarning
+        import urllib3
+        urllib3.disable_warnings()
+    return verify
 
 
 def connect_to_destination_over_circuit(dest, circ_id, session, cont, max_dl):





More information about the tor-commits mailing list