i have been using this request to fetch positions in python for last 2 years, which uses api key and access_token. I started giving me error today. what changes has been done ? what's the new request i have to send now in python.
@SZM059, We have always mentioned to use authentication on request headers and not on query params. The query param way of authentication was always for legacy reasons. Users were directed to use auth headers from the very beginning.
I have resolved the issue now from the suggestion retrieved on another thread.
But i want to know how would someone know all these changes in advance instead facing bugs in market realtime.
Its giving error as
{'data': None,
'error_type': 'InputException',
'message': 'Missing or empty field `exchange`',
'status': 'error'}
I am passing the exchange in data as below
{'exchange': 'NFO',
'order_type': 'LIMIT',
'price': 0.75,
'product': 'NRML',
'quantity': 4200,
'tradingsymbol': 'MIDCPNIFTY23O099125CE',
'transaction_type': 'BUY',
'validity': 'DAY'}
The code is as below:
url = "https://api.kite.trade/orders/regular"
payload = { "tradingsymbol":tradingsymbol,
"exchange":exchange,
"order_type":"LIMIT",
"product":"NRML",
"validity":"DAY",
"quantity":quantity,
"transaction_type":transaction_type,
"price":limit_price}
auth_header = api_key + ":" + access_token
headers["Authorization"] = "token {}".format(auth_header)
res = requests.post(url, data=payload, headers=headers)
We have always mentioned to use authentication on request headers and not on query params. The query param way of authentication was always for legacy reasons. Users were directed to use auth headers from the very beginning.