Open nesaram2020 opened 3 years ago
The Steps are very similar to to accessing production environment . First of login to kotak api dev page
Hi, Unable to access Sandbox environment. When this code below executes, getting an error below. (Note : I am passing all the right credentials found on my API portal for Sandbox environment)
client = ks_api.KSTradeApi(access_token = "", userid = "", \ consumer_key = "", ip = "127.0.0.1", app_id = "", host = "https://sbx.kotaksecurities.com/apim")
Error Message: ks_api_client.exceptions.ApiException: (401) Reason: Unauthorized HTTP response body: {"fault":{"code":900902,"message":"Missing Credentials","description":"Invalid Credentials. Make sure your API invocation call has a header: 'Authorization : Bearer ACCESS_TOKEN' or 'Authorization : Basic ACCESS_TOKEN' or 'apikey: API_KEY'"}}
Pls help
Also, when I use Sandbox and place ordres., where will these orders show up (is there another test terminal where these orders would be visible?)
@Algotrader77 with this much of code it is hard to detect where the problem is if you want you can mail me on kalilinuxuser5@gmail.com
Hi kalilinuxuser5 @.***>
Thanks for the prompt response.
I am trying to connect to the sandbox environment of Kotak Securities and I get an error message when I try to do so. I have generated the access code,consumer code for the sandbox environment in the API portal. Then, I try to execute the following line of code as suggested in the Git.
client = ks_api.KSTradeApi(access_token = "access_token", userid = "user_id", \ consumer_key = "consumer_key", ip = "127.0.0.1", app_id = "kotak_appId", host = "https://sbx.kotaksecurities.com/apim")
Following is the error I get.
PS E:\Algo\AlgoBase> &
C:/Users/gurur/AppData/Local/Microsoft/WindowsApps/python3.9.exe
e:/Algo/AlgoBase/KotakSandbox.py
Traceback (most recent call last):
File "e:\Algo\AlgoBase\KotakSandbox.py", line 15, in
Thanks & appreciate the help Vivek
On Wed, Dec 1, 2021 at 7:35 AM kalilinux-png @.***> wrote:
@Algotrader77 https://github.com/Algotrader77 with this much of code it is hard to detect where the problem is if you want you can mail me on @.***
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/osparamatrix/ks-orderapi-python/issues/41#issuecomment-983213434, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWFAKLTCSNOLDNS5C5SXRK3UOV7F7ANCNFSM5DMJQHLQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Sorry.. this is the code. I executed the first time with Quotes. However, I get the exact same error. Is the sandbox https://sbx.kotaksecurities.com/apim URL valid?
Thanks Vivek
On Fri, Dec 3, 2021 at 8:22 PM media mention2020 @.***> wrote:
Hi kalilinuxuser5 @.***>
Thanks for the prompt response.
I am trying to connect to the sandbox environment of Kotak Securities and I get an error message when I try to do so. I have generated the access code,consumer code for the sandbox environment in the API portal. Then, I try to execute the following line of code as suggested in the Git.
client = ks_api.KSTradeApi(access_token = "access_token", userid = "user_id", \ consumer_key = "consumer_key", ip = "127.0.0.1", app_id = "kotak_appId", host = "https://sbx.kotaksecurities.com/apim")
Following is the error I get. PS E:\Algo\AlgoBase> & C:/Users/gurur/AppData/Local/Microsoft/WindowsApps/python3.9.exe e:/Algo/AlgoBase/KotakSandbox.py Traceback (most recent call last): File "e:\Algo\AlgoBase\KotakSandbox.py", line 15, in
client = ks_api.KSTradeApi(access_token = "access_token", userid = "user_id", \ File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\ks_api.py", line 24, in init session_init_res = ks_api_client.SessionApi(self.api_client).session_init(self.userid, \ File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\api\session_api.py", line 397, in session_init return self.session_init_with_http_info(userid, consumerKey, ip, appId, **kwargs) # noqa: E501 File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\api\session_api.py", line 510, in session_init_with_http_info return self.api_client.call_api( File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\api_client.py", line 354, in call_api return self.call_api(resource_path, method, File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\api_client.py", line 173, in call_api raise e File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\api_client.py", line 166, in __call_api response_data = self.request( File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\api_client.py", line 380, in request return self.rest_client.GET(url, File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\rest.py", line 220, in GET return self.request("GET", url, File "C:\Users\gurur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ks_api_client\rest.py", line 214, in request raise ApiException(status = r.status, reason = r.reason, body = r.data) ks_api_client.exceptions.ApiException: (401) Reason: Unauthorized HTTP response body: {"fault":{"code":900901,"message":"Invalid Credentials","description":"Access failure for API: /apim/session/1.0, version: 1.0 status: (900901) - Invalid Credentials. Make sure you have provided the correct security credentials"}} Thanks & appreciate the help Vivek
On Wed, Dec 1, 2021 at 7:35 AM kalilinux-png @.***> wrote:
@Algotrader77 https://github.com/Algotrader77 with this much of code it is hard to detect where the problem is if you want you can mail me on @.***
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/osparamatrix/ks-orderapi-python/issues/41#issuecomment-983213434, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWFAKLTCSNOLDNS5C5SXRK3UOV7F7ANCNFSM5DMJQHLQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Getting same error
I am also getting same error. Does sandbox mode work?
Hi Could you please advise me
Thanks in advance for your support and guidance.