Autoconnect now working

RS6006
I am trying to autoconnect with a piece of code that I found online.
http_session = requests.Session()
url = http_session.get(url='https://kite.trade/connect/login?v=3&api_key='+ api_key).url
response = http_session.post(url='https://kite.zerodha.com/api/login', data={'user_id':user_id, 'password':user_password})
resp_dict = json.loads(response.content)
http_session.post(url='https://kite.zerodha.com/api/twofa', data={'user_id':user_id, 'request_id':resp_dict["data"]["request_id"], 'twofa_value':pyotp.TOTP(totp_key).now()})
url = url + "&skip_session=true"
response_url = http_session.get(url=url, allow_redirects=True).url
request_token = parse_qs(urlparse(response_url).query)['request_token'][0]

kite = KiteConnect(api_key=api_key)
data = kite.generate_session(request_token, api_secret=api_secret)
kite.set_access_token(data["access_token"])
While doing so, I am facing,
KeyError: 'request_token' because the response_url variable doesn't contain it. The response_url is as 'https://kite.zerodha.com/connect/login?sess_id=**********&api_key=***********&skip_session=true'
I am not sure why request_token is not part of it.


Any help here from fellow traders is appreciated
This discussion has been closed.