Python: Surpass SSL verification with urllib3
Question: Connectiing to SSL server is throwing an error:

> error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify
> failed

I'm using this urllib3 python library for connecting to server, using this
method:

    
    
    urllib3.connectionpool.connection_from_url(['remote_server_url'], maxsize=2)
    

How can i ignore SSL verification? Or is there another step for doing this?

Thanks.


Answer: You should be able to force urllib3 to use an unverified HTTPSConnection
object by overriding the static `ConnectionCls` property of any ConnectionPool
instance. For example:

    
    
    from urllib3.connection import UnverifiedHTTPSConnection
    from urllib3.connectionpool import connection_from_url
    
    # Get a ConnectionPool object, same as what you're doing in your question
    http = connection_from_url(remote_server_url, maxsize=2)
    
    # Override the connection class to force the unverified HTTPSConnection class
    http.ConnectionCls = UnverifiedHTTPSConnection
    
    # Make requests as normal...
    r = http.request(...)
    

For additional reference, you can [check some of our
tests](https://github.com/shazow/urllib3/blob/ba06933310dbd5764e2baa53f3505cf54eae56f7/test/with_dummyserver/test_https.py#L106)
which do similar overriding.

I've [opened an issue to improve our
documentation](https://github.com/shazow/urllib3/issues/403#issuecomment-45660345)
on how and when this should be done. We always appreciate pull requests, if
you'd like to contribute. :)

