ssl.CertificateError while Uploading transactions to YNAB
JoostGadellaa opened this issue · 2 comments
I've been getting this error, I think once every two days or so:
Incoming call from 185.40.109.65...
Reading list of payments...
Translating payments...
Uploading transactions to YNAB...
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 346, in connect
_match_hostname(cert, self.assert_hostname or hostname)
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 356, in _match_hostname
match_hostname(cert, asserted_hostname)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 327, in match_hostname
% (hostname, ', '.join(map(repr, dnsnames))))
ssl.CertificateError: hostname 'api.youneedabudget.com' doesn't match either of 'app.youneedabudget.com', 'classic.youneedabudget.com', 'forum.youneedabudget.com', 'purchase.youneedabudget.com', 'youneedabudget.com', 'www.youneedabudget.com'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.youneedabudget.com', port=443): Max retries exceeded with url: /v1/budgets/1ae2ac02-b19a-4f57-a39e-9dfc956a5a5d/transactions/bulk (Caused by SSLError(CertificateError("hostname 'api.youneedabudget.com' doesn't match either of 'app.youneedabudget.com', 'classic.youneedabudget.com', 'forum.youneedabudget.com', 'purchase.youneedabudget.com', 'youneedabudget.com', 'www.youneedabudget.com'",),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "auto_sync.py", line 91, in
sync()
File "auto_sync.py", line 70, in sync
transactions)
File "/Applications/bunq2ynab/ynab.py", line 135, in upload_transactions
result = post(method, {"transactions": ynab_transactions})
File "/Applications/bunq2ynab/ynab.py", line 151, in post
return call('POST', method, data)
File "/Applications/bunq2ynab/ynab.py", line 75, in call
reply = requests.post(url + method, headers=headers, data=data)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.youneedabudget.com', port=443): Max retries exceeded with url: /v1/budgets/1ae2ac02-b19a-4f57-a39e-9dfc956a5a5d/transactions/bulk (Caused by SSLError(CertificateError("hostname 'api.youneedabudget.com' doesn't match either of 'app.youneedabudget.com', 'classic.youneedabudget.com', 'forum.youneedabudget.com', 'purchase.youneedabudget.com', 'youneedabudget.com', 'www.youneedabudget.com'",),))
Removing old callback...
This is due to one of the YNAB hosting certificates not listing "api.youneedabudget.com". YNAB says their "platform partner" has not updated all their certificates, see this YNAB forum post: https://support.youneedabudget.com/t/k9g4wr/hostname-mismatch.
I've modifed the auto-sync code to continue after an exception: ea326ce
The issue hasn't occurred for a while now. Looks like YNAB's platform partner has updated all their certificates.