asks icon indicating copy to clipboard operation
asks copied to clipboard

ssl.CertificateError: hostname doesn't match

Open freis opened this issue 4 years ago • 4 comments

Hi all, I'm using asks==2.3.6 and getting "ssl.CertificateError: hostname doesn't match". I've used the session.get(url, verify=False), still no luck, am I missing something or is this a bug? To note that I'm using ip:port to make the get.

freis avatar Sep 24 '19 11:09 freis

Anyone could shed some light on this issue?

freis avatar Sep 26 '19 23:09 freis

hi @freis. It seems to me like the verify keyword was never implemented. I can implement it in the following week, if you do not want to.

To avoid issues like this in the future, it would probably be nice to have some sanity checking on the **kwargs, so users do not pass in invalid keys.

carlbordum avatar Sep 27 '19 10:09 carlbordum

Oh I was under the impression that this was implemented to bypass this issues that I'm getting.

freis avatar Sep 27 '19 13:09 freis

So I found the way to do this:

import asks
import trio
import ssl

ssl_ctx = ssl.create_default_context()
ssl_ctx.check_hostname = False
ssl_ctx.verify_mode = ssl.CERT_NONE

async def example():
    s = asks.Session(ssl_context=ssl_ctx)
    r = await s.get(url)
    print(r.url)

trio.run(example)

However it would be nice to have the ability to do something like request with the keyword verify=False to skip this setup I would say.

freis avatar Sep 28 '19 21:09 freis