Kotak-Neo / kotak-neo-api

100 stars 86 forks source link

getting error while logging #41

Closed isapansoni closed 10 months ago

isapansoni commented 11 months ago

I am gettig below error Traceback (most recent call last): File "/Users/sapansoni/Desktop/my_codes/kotak/utils/KotakApi.py", line 13, in <module> client.login(mobilenumber=Mobile, password=Pass) File "/Users/sapansoni/Desktop/my_codes/kotak/venv_kotak1/lib/python3.9/site-packages/neo_api_client/neo_api.py", line 120, in login gen_otp = neo_api_client.LoginAPI(self.api_client).generate_otp() File "/Users/sapansoni/Desktop/my_codes/kotak/venv_kotak1/lib/python3.9/site-packages/neo_api_client/api/login_api.py", line 86, in generate_otp userId = self.api_client.configuration.extract_userid(self.api_client.configuration.view_token) File "/Users/sapansoni/Desktop/my_codes/kotak/venv_kotak1/lib/python3.9/site-packages/neo_api_client/neo_utility.py", line 47, in extract_userid raise ApiValueError( neo_api_client.exceptions.ApiValueError: View Token hasn't been Generated Kindly Call the Login Function and Try to Generate OTP

I am running below code which is producing error

`from neo_api_client import NeoAPI from cred import * def on_message(message): print(message)

def on_error(error_message): print(error_message)

client = NeoAPI(consumer_key=consumer_key, consumer_secret=consumer_secret,environment='prod', on_message=on_message, on_error=on_error, on_close=None, on_open=None) client.login(mobilenumber=Mobile, password=Pass)

otp = input("Enter OTP: ")

client.session_2fa(OTP=otp)

`

ShreyasVarun commented 11 months ago

client = NeoAPI(consumer_key=, consumer_secret=,

            environment='prod', on_message=on_message, on_error=on_error, on_close=None, on_open=None)

CHANGE the "environment to "prod". Hope this helps

isapansoni commented 11 months ago

I am using environment as prod only , below is the code I am using for same `from neo_api_client import NeoAPI from cred import * def on_message(message): print(message)

def on_error(error_message): print(error_message)

client = NeoAPI(consumer_key=consumer_key, consumer_secret=consumer_secret,environment='prod', on_message=on_message, on_error=on_error, on_close=None, on_open=None) client.login(mobilenumber=Mobile, password=Pass)

otp = input("Enter OTP: ")

client.session_2fa(OTP=otp) `

isapansoni commented 11 months ago

@ShreyasVarun @shashwat001 @Kotak-Neo please help

isapansoni commented 10 months ago

can someone help me with same ?

syedasif11 commented 10 months ago

Some hints for debugging: Check if the mobile number is in this format: +91xxxxxxxxx as str Broker portal (not the Dev portal) password to be used (I had made this mistake) Try passing the access token as well when creating the object: client = NeoAPI(access_token=neo_creds.accesstoken.strip(), consumer_key=neo_creds.consumerkey.strip(), consumer_secret=neo_creds.consumer_secret.strip(), environment='prod', on_close=None, on_open=None)

isapansoni commented 10 months ago

@syedasif11 thank you for the response somehow I have created another app in dev api portal and was using it ,after using key & secret for default app , I am able to login