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 Certificate Verify Failed #955

Closed
bySam opened this issue Jul 4, 2016 · 11 comments
Closed

SSL Certificate Verify Failed #955

bySam opened this issue Jul 4, 2016 · 11 comments

Comments

@bySam
Copy link

bySam commented Jul 4, 2016

Long story short

I get a SSL certificate verification error running aiohttp despite being able to connect to the website using Firefox and cURL.

Expected behaviour

To get my response

Actual behaviour

See Long Story Short

Steps to reproduce

`    with aiohttp.Timeout(10):
        session = aiohttp.ClientSession()
        url = 'https://api.lootbox.eu/pc/us/'
        async with session.get(url) as response:
            if response.status == 200:
                rtxt = await response.text()`

Your environment

Windows 10, Python 3.5.2

@asvetlov
Copy link
Member

asvetlov commented Jul 6, 2016

I don't know what's wrong with certificates for your site but you may disable certificate checks by passing verify_ssl=False to connector ctor:

session = aiohhtp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False))

@asvetlov asvetlov closed this as completed Jul 6, 2016
@mickeyl
Copy link

mickeyl commented May 23, 2017

FWIW, (sadly) there are a lot of embedded systems out there which contain invalid SSL certificates. Systems which we can't update / are not under our maintenance. For these cases it's good that we can disable certification validation with aiohttp.

@asvetlov
Copy link
Member

For your pleasure

@monkeym4ster
Copy link

Navigate to
cd /Applications/Python\ 3.7/

Click on Install Certificates.command

This should solve it.

@john-shine
Copy link

john-shine commented Dec 23, 2019

Better with certifi module:

import ssl
import certifi

sslcontext = ssl.create_default_context(cafile=certifi.where())
with aiohttp.Timeout(10):
        ......
        async with session.get(url, ssl=sslcontext) as response:
            ......

@kerchner
Copy link

On my Mac with Python 3.8, running this resolved it:
/System/Volumes/Data/Applications/Python 3.8/Install Certificates.command

@lk-jeffpeck
Copy link

For anyone still looking for this and using conda, also check your conda version:
conda/conda-build#2255

@Cowm00
Copy link

Cowm00 commented Jan 18, 2021

FYI, verify_ssl is deprecated, use ssl=False instead:
connector=aiohttp.TCPConnector(ssl=False)

@merrymercy
Copy link

@monkeym4ster It works! Thanks

@VAUsIGT
Copy link

VAUsIGT commented Mar 27, 2024

"SSL: CERTIFICATE_VERIFY_FAILED" - the bot tries to contact the site, but sees an unknown certificate on it. You need to manually upload this certificate to trusted:

  1. On the website, click on the lock (next to the url) --> find a valid certificate --> in the advanced tab, export it in the ".crt" format
  2. Open "MMC" via start. Next, file --> add snap-in --> certificates --> add --> my account (then also add for local PC) --> open certificates - local PC through the root of the console --> action --> all tasks --> next and overview --> find the certificate downloaded in paragraph 1 --> done!

@hayotech
Copy link

Navigate to cd /Applications/Python\ 3.7/

Click on Install Certificates.command

This should solve it.

This solved the problem %100. Thanks!

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