Binance SSL: CERTIFICATE_VERIFY_FAILED

See original GitHub issue

I’m trying to connect to binance, and just testing the load_markets function, but I’m getting an SSL error.

bin = ccxt.binance({'apiKey':BinanceKey1,'secret':BinanceSecret1})
bin.verbose = True
bin.load_markets()

And Output:

https://api.binance.com/api/v1/exchangeInfo GET https://api.binance.com/api/v1/exchangeInfo 
Request: {'User-Agent': 'ccxt/1.10.343 (+https://github.com/ccxt/ccxt) Python/3.6.3', 'Accept-Encoding': 'gzip, deflate'} None
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1026, in _send_output
    self.send(msg)
  File "C:\ProgramData\Anaconda3\lib\http\client.py", line 964, in send
    self.connect()
  File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1400, in connect
    server_hostname=server_hostname)
  File "C:\ProgramData\Anaconda3\lib\ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "C:\ProgramData\Anaconda3\lib\ssl.py", line 814, in __init__
    self.do_handshake()
  File "C:\ProgramData\Anaconda3\lib\ssl.py", line 1068, in do_handshake
    self._sslobj.do_handshake()
  File "C:\ProgramData\Anaconda3\lib\ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 319, in fetch
    response = opener.open(request, timeout=int(self.timeout / 1000))
  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 526, in open
    response = self._open(req, data)
  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 544, in _open
    '_open', req)
  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 504, in _call_chain
    result = func(*args)
  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 1361, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/scoss/PycharmProjects/Bitcoin/ccxt_test.py", line 31, in <module>
    bin.load_markets()
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 786, in load_markets
    markets = self.fetch_markets()
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\binance.py", line 237, in fetch_markets
    response = self.publicGetExchangeInfo()
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\binance.py", line 669, in request
    response = self.fetch2(path, api, method, params, headers, body)
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 277, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 338, in fetch
    self.raise_error(ExchangeNotAvailable, url, method, e)
  File "C:\ProgramData\Anaconda3\lib\site-packages\ccxt\base\exchange.py", line 259, in raise_error
    details,
ccxt.base.errors.ExchangeNotAvailable: binance GET https://api.binance.com/api/v1/exchangeInfo <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)> 

Not having issues with other exchanges, and this key/secret pair works without ccxt

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:39 (20 by maintainers)

github_iconTop GitHub Comments

3reactions
kroitorcommented, Dec 21, 2017

This issue is fixed in version 1.10.436. Can you guys test and verify it, please? We will be thankful for your reports!

3reactions
kroitorcommented, Dec 19, 2017

@hexdump2002 today or tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSL Certification Validation Failed in Binance Connector for ...
I would propose a simple solution, by trying this I have successfully implemented your code and it works for me. Output as proof:...
Read more >
Keep getting SSL errors (with some DNS) using binance ...
Normal spot examples run fine but when I run any websocket example I get this error: INFO:root:Start to connect.... WARNING:root:WebSocket ...
Read more >
“SSL:CERTIFICATE_VERIFY_FAILED” Error in Comet— Fixed
I was getting the “SSL:CERTIFICATE_VERIFY_FAILED” error repeatedly anytime I try to deploy my code to the platform.
Read more >
What is an SSL 'Certificate_Verify_Failed' Error and How Do I ...
SSL certificate_verify_failed errors typically occur as a result of outdated Python default certificates or invalid root certificates. If you're a website owner ...
Read more >
How to Fix "App certificate cannot be verified" on Binance
In this video, you will learn how to Fix "App certificate cannot be verified" on Binance and why you getting this error.original article: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found