Error in getting Access Token for kite connect API

RamakrishnaG
Can anyone help me with the error?

I successfully generated request_token, checksum and I am trying to get access_token with the following python code snippet.

access_token_link= "https://api.kite.trade/session/token?api_key="+api_key+"&request_token="+request_token+"&checksum="+checksum
print(access_token_link)
access_token = urllib.request.urlopen(access_token_link).read()
print (access_token)

I could see access_token link is properly formed but the access_token giving error.

raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
  • sujith
    Hi @RamakrishnaG,
    You need to make a post request for the access token and request token, api_key and api_secret must be hashed while sending as params. Please take a look at python code to know more about it.
  • RamakrishnaG
    Thanks Sujith for the response.
    I am using checksum as the hashed value of api_key, request_token,api_secret in the url. I did not get any issues for these values except access_key.
    I am a learner on this technology, would you mind mentioning the syntax for POST request. Thanks for the help.
  • RamakrishnaG
    I found the solution. Below is the code snippet that will give access_key.

    access_token_link= "https://api.kite.trade/session/token?api_key="+api_key+"&request_token="+request_token+"&checksum="+checksum
    result=requests.post(access_token_link).content.decode()
    print (result)
This discussion has been closed.