-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving 400 Error #1
Comments
NOw Receiving : |
Hi, I see the problem at my end. Let me have a look and get back to you. Thanks for raising the issue. |
I used Kite last evening and everything was working well. I suppose Zerodha has introduced changes or this is a temporary issue. I'll have a look in the evening. If the issue persists, will look into it further. |
Chiming in to say the same. Also facing the issue on my end. Doesn't matter if cookies file is deleted or exists. checked passwords and passed values multiple times, always returns 400 error - File "/home///venv/lib/python3.11/site-packages/kitetrader/Kite.py", line 197, in _req Also thanks for sharing this awesome project with us :). If you need any testing help, give us a shout! |
@sarekv Its nothing to do with the code. The change is server side. Either a missing header or cookie value is causing the error. I will run tests on Monday as this might take some time. |
I tried to get this fixed but so far failed. It looks like cloudflare is rejecting requests based on some parameter. I had a similar problem with NSE blocking requests orginating from other servers. Making a request through curl does work. So a workaround might still be possible. But I wont commit to this immediately. The issue is not isolated to this library. Others are also facing the same issue. |
@BennyThadikaran, I tried manually as well and the requests are failing when we use enctoken for Authorization in headers. ![]() |
Any resolution? |
Like i said before, the requests are being proxied through Cloudflare and are being rejected. My understanding is requests using enctoken authorization header is being rejected. Since Also Kite Web uses different endpoints in the browser, though under the hood they're likely using the same API. So anyone accessing the api using KiteConnect endpoints and using enctoken authorization headers are being rejected. It is clear, they are not pleased with unofficial libraries accessing their data. Lets respect that. I will wait a few weeks and see how things play out. Its unlikely Zerodha will rollback these changes. Meanwhile there is interesting discussion on Kite blog. 😄 |
Every broker provide there API is in free but zerodha takes 2k monthly also need to pay high brokrage. It's high time to switch other broker. Zerodha should remove zero from there name. |
All the methods except( for the |
I am trying to develop this but facing some lag in getting tick data. I have subscribed around 400 instruments, after few seconds it starts getting slow. Not sure if there is any issue at my end or something is wrong from Zerodha web sockets. |
The Kite web endpoints should definitely work. I just dont want to put in the work on that front because it is only a matter of time that Zerodha will introduce changes to secure it. If Kite Websockets works, you can have a look at Aio-Trader. I built it using aio-http library. It has some speed optimizations though i doubt it makes any overall difference from PyKiteConnect. The major advantage is a reduced dependencies. I may switch to using Fyers or Dhan in the future for my scripts. Instead of Redis you can use SQLite which is part of python standard library and easy to setup. An in-memory sqlite database should be fast enough depending on how many instruments you're working with. Instead of updating the Db on very tick, store the ticks in a Python list and update every 10 secs or 1 min depending on your requirements. At some interval like 5 mins, you can run a function to extract tick data and convert to OHLC and store it whereever you need. You can use APScheduler to run at intervals. I've had plans since a long time to implement something like this. If you choose to open source your work, I'd be happy to contribute. |
Added not updating status on #1
I am closing this issue as there is nothing to be done here. Anyone wishing to fork this library and implement a workaround is free to do so. |
I have just released v3.0.2 which allows downloading historical data and instruments with Kite Web login. The rest of the methods will be unavailable on Kite Web. Run |
I tried running you code 👍
from kitetrader import Kite
kite = Kite()
kite.profile()
kite.holdings()
But Receiving error:
File "venv/lib/python3.11/site-packages/kitetrader/Kite.py", line 257, in _req
raise ConnectionError(f"{hint} | {code}: {reason}")
ConnectionError: Profile | 400: Missing or bad request parameters or values
The text was updated successfully, but these errors were encountered: