CertificateError Traceback (most recent call last)
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:703, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
702 # Make the request on the httplib connection object.
--> 703 httplib_response = self._make_request(
704 conn,
705 method,
706 url,
707 timeout=timeout_obj,
708 body=body,
709 headers=headers,
710 chunked=chunked,
711 )
713 # If we're going to release the connection in finally:, then
714 # the response doesn't need to know about the connection. Otherwise
715 # it will also try to release it and we'll have a double-release
716 # mess.
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:386, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
385 try:
--> 386 self._validate_conn(conn)
387 except (SocketTimeout, BaseSSLError) as e:
388 # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:1040, in HTTPSConnectionPool._validate_conn(self, conn)
1039 if not getattr(conn, "sock", None): # AppEngine might not have .sock
-> 1040 conn.connect()
1042 if not conn.is_verified:
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connection.py:469, in HTTPSConnection.connect(self)
460 warnings.warn(
461 (
462 "Certificate for {0} has no subjectAltName, falling back to check for a "
(...)
467 SubjectAltNameWarning,
468 )
--> 469 _match_hostname(cert, self.assert_hostname or server_hostname)
471 self.is_verified = (
472 context.verify_mode == ssl.CERT_REQUIRED
473 or self.assert_fingerprint is not None
474 )
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connection.py:542, in _match_hostname(cert, asserted_hostname)
541 try:
--> 542 match_hostname(cert, asserted_hostname)
543 except CertificateError as e:
File ~/miniconda3/lib/python3.9/site-packages/urllib3/util/retry.py:592, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
591 if new_retry.is_exhausted():
--> 592 raise MaxRetryError(_pool, url, error or ResponseError(cause))
594 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
MaxRetryError: HTTPSConnectionPool(host='shoonyatrade.finvasia.com', port=443): Max retries exceeded with url: /NorenWClientTP//QuickAuth (Caused by SSLError(CertificateError("hostname 'shoonyatrade.finvasia.com' doesn't match 'shoonya.finvasia.com'")))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
Cell In [6], line 6
4 api = ShoonyaApiPy()
5 #credentials by login
----> 6 ret = api.login(userid=user, password=u_pwd, twoFA=pyotp.TOTP(token).now(), vendor_code=vc,
7 api_secret=app_key, imei=imei)
File ~/miniconda3/lib/python3.9/site-packages/requests/api.py:117, in post(url, data, json, kwargs)
105 def post(url, data=None, json=None, kwargs):
106 r"""Sends a POST request.
107
108 :param url: URL for the new :class:Request object.
(...)
114 :rtype: requests.Response
115 """
--> 117 return request('post', url, data=data, json=json, **kwargs)
File ~/miniconda3/lib/python3.9/site-packages/requests/api.py:61, in request(method, url, kwargs)
57 # By using the 'with' statement we are sure the session is closed, thus we
58 # avoid leaving sockets open which can trigger a ResourceWarning in some
59 # cases, and look like a memory leak in others.
60 with sessions.Session() as session:
---> 61 return session.request(method=method, url=url, kwargs)
File ~/miniconda3/lib/python3.9/site-packages/requests/sessions.py:645, in Session.send(self, request, kwargs)
642 start = preferred_clock()
644 # Send the request
--> 645 r = adapter.send(request, kwargs)
647 # Total elapsed time of the request (approximately)
648 elapsed = preferred_clock() - start
File ~/miniconda3/lib/python3.9/site-packages/requests/adapters.py:517, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
513 raise ProxyError(e, request=request)
515 if isinstance(e.reason, _SSLError):
516 # This branch is for urllib3 v1.22 and later.
--> 517 raise SSLError(e, request=request)
519 raise ConnectionError(e, request=request)
521 except ClosedPoolError as e:
SSLError: HTTPSConnectionPool(host='shoonyatrade.finvasia.com', port=443): Max retries exceeded with url: /NorenWClientTP//QuickAuth (Caused by SSLError(CertificateError("hostname 'shoonyatrade.finvasia.com' doesn't match 'shoonya.finvasia.com'")))
CertificateError Traceback (most recent call last) File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:703, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 702 # Make the request on the httplib connection object. --> 703 httplib_response = self._make_request( 704 conn, 705 method, 706 url, 707 timeout=timeout_obj, 708 body=body, 709 headers=headers, 710 chunked=chunked, 711 ) 713 # If we're going to release the connection in
finally:
, then 714 # the response doesn't need to know about the connection. Otherwise 715 # it will also try to release it and we'll have a double-release 716 # mess.File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:386, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 385 try: --> 386 self._validate_conn(conn) 387 except (SocketTimeout, BaseSSLError) as e: 388 # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:1040, in HTTPSConnectionPool._validate_conn(self, conn) 1039 if not getattr(conn, "sock", None): # AppEngine might not have
.sock
-> 1040 conn.connect() 1042 if not conn.is_verified:File ~/miniconda3/lib/python3.9/site-packages/urllib3/connection.py:469, in HTTPSConnection.connect(self) 460 warnings.warn( 461 ( 462 "Certificate for {0} has no
subjectAltName
, falling back to check for a " (...) 467 SubjectAltNameWarning, 468 ) --> 469 _match_hostname(cert, self.assert_hostname or server_hostname) 471 self.is_verified = ( 472 context.verify_mode == ssl.CERT_REQUIRED 473 or self.assert_fingerprint is not None 474 )File ~/miniconda3/lib/python3.9/site-packages/urllib3/connection.py:542, in _match_hostname(cert, asserted_hostname) 541 try: --> 542 match_hostname(cert, asserted_hostname) 543 except CertificateError as e:
File ~/miniconda3/lib/python3.9/site-packages/urllib3/util/ssl_match_hostname.py:157, in match_hostname(cert, hostname) 156 elif len(dnsnames) == 1: --> 157 raise CertificateError("hostname %r doesn't match %r" % (hostname, dnsnames[0])) 158 else:
CertificateError: hostname 'shoonyatrade.finvasia.com' doesn't match 'shoonya.finvasia.com'
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last) File ~/miniconda3/lib/python3.9/site-packages/requests/adapters.py:440, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies) 439 if not chunked: --> 440 resp = conn.urlopen( 441 method=request.method, 442 url=url, 443 body=request.body, 444 headers=request.headers, 445 redirect=False, 446 assert_same_host=False, 447 preload_content=False, 448 decode_content=False, 449 retries=self.max_retries, 450 timeout=timeout 451 ) 453 # Send the request. 454 else:
File ~/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py:785, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 783 e = ProtocolError("Connection aborted.", e) --> 785 retries = retries.increment( 786 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] 787 ) 788 retries.sleep()
File ~/miniconda3/lib/python3.9/site-packages/urllib3/util/retry.py:592, in Retry.increment(self, method, url, response, error, _pool, _stacktrace) 591 if new_retry.is_exhausted(): --> 592 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 594 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
MaxRetryError: HTTPSConnectionPool(host='shoonyatrade.finvasia.com', port=443): Max retries exceeded with url: /NorenWClientTP//QuickAuth (Caused by SSLError(CertificateError("hostname 'shoonyatrade.finvasia.com' doesn't match 'shoonya.finvasia.com'")))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last) Cell In [6], line 6 4 api = ShoonyaApiPy() 5 #credentials by login ----> 6 ret = api.login(userid=user, password=u_pwd, twoFA=pyotp.TOTP(token).now(), vendor_code=vc, 7 api_secret=app_key, imei=imei)
File ~/miniconda3/lib/python3.9/site-packages/NorenRestApiPy/NorenApi.py:238, in NorenApi.login(self, userid, password, twoFA, vendor_code, api_secret, imei) 235 payload = 'jData=' + json.dumps(values) 236 reportmsg("Req:" + payload) --> 238 res = requests.post(url, data=payload) 239 reportmsg("Reply:" + res.text) 241 resDict = json.loads(res.text)
File ~/miniconda3/lib/python3.9/site-packages/requests/api.py:117, in post(url, data, json, kwargs) 105 def post(url, data=None, json=None, kwargs): 106 r"""Sends a POST request. 107 108 :param url: URL for the new :class:
Request
object. (...) 114 :rtype: requests.Response 115 """ --> 117 return request('post', url, data=data, json=json, **kwargs)File ~/miniconda3/lib/python3.9/site-packages/requests/api.py:61, in request(method, url, kwargs) 57 # By using the 'with' statement we are sure the session is closed, thus we 58 # avoid leaving sockets open which can trigger a ResourceWarning in some 59 # cases, and look like a memory leak in others. 60 with sessions.Session() as session: ---> 61 return session.request(method=method, url=url, kwargs)
File ~/miniconda3/lib/python3.9/site-packages/requests/sessions.py:529, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 524 send_kwargs = { 525 'timeout': timeout, 526 'allow_redirects': allow_redirects, 527 } 528 send_kwargs.update(settings) --> 529 resp = self.send(prep, **send_kwargs) 531 return resp
File ~/miniconda3/lib/python3.9/site-packages/requests/sessions.py:645, in Session.send(self, request, kwargs) 642 start = preferred_clock() 644 # Send the request --> 645 r = adapter.send(request, kwargs) 647 # Total elapsed time of the request (approximately) 648 elapsed = preferred_clock() - start
File ~/miniconda3/lib/python3.9/site-packages/requests/adapters.py:517, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies) 513 raise ProxyError(e, request=request) 515 if isinstance(e.reason, _SSLError): 516 # This branch is for urllib3 v1.22 and later. --> 517 raise SSLError(e, request=request) 519 raise ConnectionError(e, request=request) 521 except ClosedPoolError as e:
SSLError: HTTPSConnectionPool(host='shoonyatrade.finvasia.com', port=443): Max retries exceeded with url: /NorenWClientTP//QuickAuth (Caused by SSLError(CertificateError("hostname 'shoonyatrade.finvasia.com' doesn't match 'shoonya.finvasia.com'")))