yadavarvind / AccessTokenGenenrator

Zerodha ( Kite ) access token generator
7 stars 7 forks source link

public_token is not coming. #1

Open jaydave1988 opened 4 years ago

jaydave1988 commented 4 years ago

DEBUG:urllib3.connectionpool:https://kite.zerodha.com:443 "POST /api/twofa HTTP/1.1" 200 42 {'status': 'success', 'data': {'profile': {}}} Traceback (most recent call last): File "C:\Users\jdave\My Documents\LiClipse Workspace\HelloPython\Zerodha\1.py", line 40, in public_token = data.json()['data']['public_token'] KeyError: 'public_token'

rajatnagpure commented 4 years ago

just change this line public_token = data.json()['data']['public_token'] to public_token = data.cookies.get_dict()['public_token']

jaydave1988 commented 4 years ago

Thanks. It worked. Now it is giving another error:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "xx\Python\Python36-32\lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "xx\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "xx\Python\Python36-32\lib\site-packages\urllib3\util\retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=80): Max retries exceeded with url: /?status=success&request_token=xxxxxxx&action=login (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x054FE450>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

graphicgeared commented 4 years ago

DEBUG:urllib3.connectionpool:https://kite.zerodha.com:443 "POST /api/twofa HTTP/1.1" 400 128 Issue with two factor authentication