Hi Jan,
Recently, I have encountered errors related to SSLCertVerification and MaxRetry below, and I am not sure what went wrong from my side. Specifically, I get these errors when I call get_account_id
method.
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
~\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
438 if not chunked:
--> 439 resp = conn.urlopen(
440 method=request.method,
~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
754
--> 755 retries = retries.increment(
756 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
~\anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
573 if new_retry.is_exhausted():
--> 574 raise MaxRetryError(_pool, url, error or ResponseError(cause))
575
MaxRetryError: HTTPSConnectionPool(host='api05.iq.questrade.com', port=443): Max retries exceeded with url: /v1/accounts (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_9912/2462350887.py in
1 acctData = {}
----> 2 acctNums = qbot.get_account_id()
3 ACCOUNT_TYPE = ESHINHW_ACCOUNT_TYPE
4 for aNum in acctNums:
5 if aNum in ACCOUNT_TYPE:
~\Desktop\GitHub\questrade-portfolio-manager\utils\qtrade.py in get_account_id(self)
221 """
222 log.info("Getting account ID...")
--> 223 response: Dict[str, List[Dict[str, int]]] = self._send_message("get", "accounts")
224
225 account_id = []
~\Desktop\GitHub\questrade-portfolio-manager\utils\qtrade.py in _send_message(self, method, endpoint, params, data, json)
89 log.error("Access token not set...")
90 raise Exception("Access token not set...")
---> 91 resp = self.session.request(method, url, params=params, data=data, json=json, timeout=30)
92 resp.raise_for_status()
93 return resp.json()
~\anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
540 }
541 send_kwargs.update(settings)
--> 542 resp = self.send(prep, **send_kwargs)
543
544 return resp
~\anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
653
654 # Send the request
--> 655 r = adapter.send(request, **kwargs)
656
657 # Total elapsed time of the request (approximately)
~\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
512 if isinstance(e.reason, _SSLError):
513 # This branch is for urllib3 v1.22 and later.
--> 514 raise SSLError(e, request=request)
515
516 raise ConnectionError(e, request=request)
SSLError: HTTPSConnectionPool(host='api05.iq.questrade.com', port=443): Max retries exceeded with url: /v1/accounts (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
Is there anything I can change on my side to fix those errors, or is it a problem from the Questrade side?
Thanks!