Kotak-Neo / kotak-neo-api

100 stars 86 forks source link

Login Issue #27

Closed shekar3110a closed 11 months ago

shekar3110a commented 11 months ago

Am not able to login am getting the below error .. not sure what am doing wrong

{"data": {"access_token": "eyJ4NXQiOiJNbUprWWpVMlpETmpNelpqTURBM05UZ3pObUUxTm1NNU1qTXpNR1kyWm1OaFpHUTFNakE1TmciLCJraWQiOiJaalJqTUdRek9URmhPV1EwTm1WallXWTNZemRtWkdOa1pUUmpaVEUxTlRnMFkyWTBZVEUyTlRCaVlURTRNak5tWkRVeE5qZ3pPVGM0TWpGbFkyWXpOUV9SUzI1NiIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJjbGllbnQ4NzcyIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOiJUM0RxVGs0YUdYYXF4SWNPZmhhV1ZyZGYzcmdhIiwibmJmIjoxNjkxNDk0OTU5LCJhenAiOiJUM0RxVGs0YUdYYXF4SWNPZmhhV1ZyZGYzcmdhIiwic2NvcGUiOiJkZWZhdWx0IiwiaXNzIjoiaHR0cHM6XC9cL25hcGkua290YWtzZWN1cml0aWVzLmNvbTo0NDNcL29hdXRoMlwvdG9rZW4iLCJleHAiOjE2OTE0OTg1NTksImlhdCI6MTY5MTQ5NDk1OSwianRpIjoiMWQ2ZmQ4MDEtMGNmOS00Zjk1LTk0MjItMTFlNWZmNDgzOTU0In0.Ker72KTYZAGIeDl-pHCbwGBA0Z3HPHAaLXYiDkOROroXTGXhyb58uA21wgX1l-1ZeWeuNN8CLXHaBIBwBowVaSy_HSOu2UG0NzvG2cSG5emy7MxSc2FzIZwwzmh4o36G08MFHf-ty7bcUGdJEBwqULatVjk2-7OezpvmU7e2UWAbGF0_PnnyB0yVjgS8UuZKc6paJ94YvRYQC--0g_u-7N7pIe18GRZm5BMzYhXkWwNCG9ktHrn1BfFzlIQUqeOdYpZ2gf78BkDW5Am84fvWrogoElyjEkaK19w24r-TceVVqQ0qcaXepalh3yr8UPdL4jo-TjYRcINuKZyZqTb6Kw", "scope": "default", "token_type": "Bearer", "expires_in": 3600}} ERROR msg (0) Reason: ChunkedEncodingError ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

Traceback (most recent call last): File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 761, in _update_chunk_length self.chunk_left = int(line, 16) ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 444, in _error_catcher yield File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 828, in read_chunked self._update_chunk_length() File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 765, in _update_chunk_length raise InvalidChunkLength(self, line) urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/requests/models.py", line 753, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 624, in stream for line in self.read_chunked(amt, decode_content=decode_content): File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 857, in read_chunked self._original_response.close() File "/usr/lib64/python3.9/contextlib.py", line 137, in exit self.gen.throw(typ, value, traceback) File "/home/ec2-user/.local/lib/python3.9/site-packages/urllib3/response.py", line 461, in _error_catcher raise ProtocolError("Connection broken: %r" % e, e) urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ec2-user/.local/lib/python3.9/site-packages/neo_api_client/rest.py", line 59, in request response = requests.post(url=url, headers=headers, data=request_body) File "/usr/lib/python3.9/site-packages/requests/api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "/usr/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 544, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 699, in send r.content File "/usr/lib/python3.9/site-packages/requests/models.py", line 831, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "/usr/lib/python3.9/site-packages/requests/models.py", line 756, in generate raise ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ec2-user/kotak.py", line 15, in client.login(mobilenumber="+My mobile number", password="MyPassword$") File "/home/ec2-user/.local/lib/python3.9/site-packages/neo_api_client/neo_api.py", line 117, in login view_token = neo_api_client.LoginAPI(self.api_client).generate_view_token(password=password, mobilenumber=mobilenumber, File "/home/ec2-user/.local/lib/python3.9/site-packages/neo_api_client/api/login_api.py", line 62, in generate_view_token generate_view_token = self.rest_client.request( File "/home/ec2-user/.local/lib/python3.9/site-packages/neo_api_client/rest.py", line 77, in request raise ApiException(status=0, reason=msg) ERROR msg (0) Reason: ChunkedEncodingError ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

neo_api_client.exceptions.ApiException: <exception str() failed>

Parrikshit commented 11 months ago

from neo_api_client import NeoAPI ModuleNotFoundError: No module named 'neo_api_client'

shekar3110a commented 11 months ago

Ok finally managed to login .. however using the PAN instead of the mobile number it worked ..

But failing to hold the keys as overtime I tried to place an order it fails with requirement for OTP authentication .. painful process for every order to automate

KSAPIHelp commented 11 months ago

you can use MPIN process for better experience.

Kotak-Neo commented 11 months ago

Also, please check the expiry of your access token, in the response shared above it is 3600s change it to 86400s on the API Manager Portal to avoid any issues during market hours.

shekar3110a commented 11 months ago

Hi How do I the main process