Python code for login using mechanizer stopped working since this week(~25 March).

diptesh1ce3
def login():
br = mechanize.Browser()

url = "https://kite.trade/connect/login?v=3&api_key=XXXXXXXXXXXXX"
br.set_handle_robots(False) # no robots
br.set_handle_refresh(False) # can sometimes hang without this

response = br.open(url)
Same code was working fine and returning expected response. but it's returning
raise response
mechanize._response.httperror_seek_wrapper: HTTP Error 403: Forbidden
at response = br.open(url) line.
  • diptesh1ce3
    I have verified that my app for api_key is valid and active, expiring on 24th April.
  • sujith
    How are you reading request token? Are you doing substring or reading query param?
  • diptesh1ce3
    It's not reaching to any token exchange part. above code will just return the page where we login in with kite ID and password but I am getting 403 at this stage only.

    When we open URL "https://kite.trade/connect/login?v=3&api_key=XXXXXXXXXXXXX", does kite expect any other parameters ?
  • diptesh1ce3
    Does this path require any specific headers ?
  • decipher
    Looks like lot of changes have happened in the login process and internal API's being used for login hence mechanizer stopped working. i was using python requests library to do the same and have re-coded my authentication code. PM me in case you need any help on the authenticator python/C# code.
  • sujith
    @diptesh1ce3,
    It is mandatory by the exchange that a user has to manually login at least once a day. We don't recommend automating login
This discussion has been closed.