finish06 / pyunifi

https://unifi-sdn.ubnt.com/
MIT License
223 stars 99 forks source link

ssl_verify attempt to suppress warnings is broken #67

Open davidc opened 3 years ago

davidc commented 3 years ago

This code does not work and also if the caller has already called urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) it prevents that from working either:

if ssl_verify is False:
    warnings.simplefilter("default", category=InsecureRequestWarning)

Removing that code from the Controller constructor allows disable_warnings() to do its job again and actually disable the warning.

requests.version '2.21.0' urllib3.version '1.24.1'

pyunifi current git version as of today.

caco3 commented 2 years ago

That patch is outdated, simply add

            import urllib3
            urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

after

        if ssl_verify is False:
            warnings.simplefilter("default", category=InsecureRequestWarning)