Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl.CertificateError: hostname doesn't match #141

Open
freis opened this issue Sep 24, 2019 · 4 comments
Open

ssl.CertificateError: hostname doesn't match #141

freis opened this issue Sep 24, 2019 · 4 comments

Comments

@freis
Copy link

freis commented Sep 24, 2019

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
Copy link
Author

freis commented Sep 26, 2019

Anyone could shed some light on this issue?

@carlbordum
Copy link
Contributor

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.

@freis
Copy link
Author

freis commented Sep 27, 2019

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

@freis
Copy link
Author

freis commented Sep 28, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants