I have double checked the credentials (both, API key and Access Token). I am using the correct ones. I am still getting below error:
kws.connect()
File "C:\Users\dheer_thakkar\Anaconda3\lib\site-packages\kiteconnect\ticker.py", line 532, in connect reactor.run(**opts)
File "C:\Users\dheer_thakkar\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1282, in run self.startRunning(installSignalHandlers=installSignalHandlers)
File "C:\Users\dheer_thakkar\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1262, in startRunning ReactorBase.startRunning(self)
File "C:\Users\dheer_thakkar\Anaconda3\lib\site-packages\twisted\internet\base.py", line 765, in startRunning raise error.ReactorNotRestartable()
ReactorNotRestartable
Also a point to note: Whenever the code is run first time in Spyder, I get below error: ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
@sujith 1. yesterday, It gave me the same access token every time I followed the steps to fetch one. 2. it gave me a new one today, but the issue still persists.
Yes. I run generate session just once. To get the access token:
api_k = "my api key" # api_key api_s = "my api secret" # api_secret
global kite kite = KiteConnect(api_key=api_k)
print("[*] Generate access Token : ", kite.login_url()) -->this gives me the URL. I go to this URL, login, and get my request token
request_tkn = input("[*] Enter Your Request Token Here : ") -->I put my request token here
data = kite.generate_session(request_tkn, api_secret=api_s) -->pickup access token from here here
print(data['access_token'])
This code is run only once.
after this I use the access token to run the skeleton I mentioned above.
And every time I do that, I get this error: ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
1. yesterday, It gave me the same access token every time I followed the steps to fetch one.
2. it gave me a new one today, but the issue still persists.
Yes. I run generate session just once. To get the access token:
api_k = "my api key" # api_key
api_s = "my api secret" # api_secret
global kite
kite = KiteConnect(api_key=api_k)
print("[*] Generate access Token : ", kite.login_url())
-->this gives me the URL. I go to this URL, login, and get my request token
request_tkn = input("[*] Enter Your Request Token Here : ")
-->I put my request token here
data = kite.generate_session(request_tkn, api_secret=api_s)
-->pickup access token from here here
print(data['access_token'])
This code is run only once.
after this I use the access token to run the skeleton I mentioned above.
And every time I do that, I get this error:
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
Even tried step by step instructions on this page to get the access token - https://kite.trade/docs/connect/v3/user/#login-flow
Still same error
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))