My KiteConnect version is 3.4 and i am able to execute kite=KiteConnect(api_key=apikey, proxies=proxy) and get the login information by routing through proxy
After login when i use kite.historical API i get back the gateway Connection Exception error that i had initially got when i faced the proxy issue at login. kite.historical API does not have proxy variable to pass value.
I want to know how to resolve this problem of accessing historical data when a proxy comes into the picture even though i am able to successfully login. The exact same code works fine in non-proxy environment.
Errors: Traceback (most recent call last): execfile(filename, namespace) exec(compile(scripttext, filename, 'exec'), glob, loc) kite.historical(inst, from_date, to_date, interval) \kiteconnect\__init__.py", line 415, in historical "interval": interval}) \kiteconnect\__init__.py", line 455, in _get return self._request(route, "GET", params) \kiteconnect\__init__.py", line 510, in _request raise ex.ClientNetworkException("Gateway connection error", code=503)
I tried debugging, the 7th line in the error output traces to a request definition which does have proxies but in historial API (unlike Connect API) does not have proxies as a parameter
That was my assumption as well but it did not work. I was able to set the proxy at login and i got the key and was able to get Kite API login output. After that historial API is erroring out with ClientNetworkException: Gateway connection error
I am still facing this problem. Able to successfully login but beyond that the historical Function errors out with Gateway connection error. The error trace is mentioned in post#1. Can you please look into it or let me know what more data you need to help in debug.
The issue was that i was evaluating proxy and non-proxy environment based on kite.connect API's output. I was expecting kite.connect (without proxy variable) to give an exception in a proxy environment. However kite.connect never erorred out and it was historical API that was catching the proxy & non-proxy environment. Now i have added a step before kite,connect to detect proxy and connect by passing proxy variable if required.
A suggestion for the forum web-layout, if you can add post# in each message, it will be easier to refer to earlier posts.
Tagging few folks @vivek @Nikhil.A @Kailash
-SR
Proxy that is being set while initialising KiteConnect is used by all requests. Checkout https://github.com/rainmattertech/pykiteconnect/blob/master/kiteconnect/__init__.py
That was my assumption as well but it did not work. I was able to set the proxy at login and i got the key and was able to get Kite API login output. After that historial API is erroring out with ClientNetworkException: Gateway connection error
-SR
I am still facing this problem. Able to successfully login but beyond that the historical Function errors out with Gateway connection error. The error trace is mentioned in post#1. Can you please look into it or let me know what more data you need to help in debug.
-SR
print(KiteConnect(api_key=apikey))
print(kite.historical(StockInstToken, FromDate, ToDate, interval)
Traceback (most recent call last):
execfile(filename, namespace)
exec(compile(scripttext, filename, 'exec'), glob, loc)
kite.historical(inst, from_date, to_date, interval)
\kiteconnect\__init__.py", line 415, in historical "interval": interval})
\kiteconnect\__init__.py", line 455, in _get return self._request(route, "GET", params)
\kiteconnect\__init__.py", line 510, in _request
raise ex.ClientNetworkException("Gateway connection error", code=503)
ClientNetworkException: Gateway connection erro
As mentioned earlier without any changes the above code works when there is no proxy involved.
@sujith @vivek @Kailash
-SR
A suggestion for the forum web-layout, if you can add post# in each message, it will be easier to refer to earlier posts.
Thanks Sujith, Vivek. This thread can be closed.
-SR