Closed tmohapat closed 1 year ago
pull the latest changes. It will work.
Hello, Thanks for your response. I have updated it to the latest and I am facing the issue. Do I need to install any certificate?
Hello, seems like their SSL certificate is expired. Again I am also facing the same issue. I have updated the repository with latest code and I am using their latest endpoints also. @Shoonya-Dev , please renew your ssl certificate.
In the ShoonyaApiPy class, change the URL. Refer below code
class ShoonyaApiPy(NorenApi):
def __init__(self):
NorenApi.__init__(self, host='https://api.shoonya.com/NorenWClientTP/', websocket='wss://api.shoonya.com/NorenWSTP/', eodhost='https://shoonya.finvasia.com/chartApi/getdata/')
global api
api = self
Hi Leena, I have updated these URL's few days back only, still issue is happening.
Greetings from FINVASIA!
Thanks for your Concern.
Have you used the sleep function for 1 second? Otherwise, this error may occur. Without using the sleep function, your program constantly puts a load on our servers.
Team Shoonya
Hello Team, I am unable to log in using the sample code you have provided (test_api.py) after providing my authentication. Below is the error I get. Do I need to download the certificate and save it somewhere? Please help.
C:\Users\ing09869\OneDrive\DataAnalysis\venv\Scripts\python.exe C:/Users/ing09869/OneDrive/DataAnalysis/Algo/Finvasia/ShoonyaApi/test_api.py DEBUG:NorenRestApiPy.NorenApi:https://api.shoonya.com/NorenWClientTP//QuickAuth DEBUG:NorenRestApiPy.NorenApi:Req:jData={"source": "API", "apkversion": "1.0.0", "uid": "FA61477", "pwd": "90371a7923c615b52530f66639e58629e0aded7ce55bac70986233b759ebd835", "factor2": "108920", "vc": "FA61477_U", "appkey": "b97e53f7fadd97f3500b01f6d6c2da8200a118cdb6dbba65e2bbd33f22ec3095", "imei": "abc1234"} DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.shoonya.com:443 Traceback (most recent call last): File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn conn.connect() File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Users\ing09869\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Users\ing09869\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Users\ing09869\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.shoonya.com', port=443): Max retries exceeded with url: /NorenWClientTP//QuickAuth (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\ing09869\OneDrive\DataAnalysis\Algo\Finvasia\ShoonyaApi\test_api.py", line 26, in
ret = api.login(userid=user, password=pwd, twoFA=totp, vendor_code=vc, api_secret=app_key, imei=imei)
File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\NorenRestApiPy\NorenApi.py", line 238, in login
res = requests.post(url, data=payload)
File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, kwargs)
File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, kwargs)
File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, send_kwargs)
File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, kwargs)
File "C:\Users\ing09869\OneDrive\DataAnalysis\venv\lib\site-packages\requests\adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.shoonya.com', port=443): Max retries exceeded with url: /NorenWClientTP//QuickAuth (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
Process finished with exit code 1