Margin Calculation Error Response 400

neel2323 edited January 13 in General

I used to convert curl to python as below.
import requests

headers = {
'X-Kite-Version': '3',
'Authorization': 'token api_key:access_token',
'Content-Type': 'application/json',

data = '[ { "exchange": "NSE", "tradingsymbol": "INFY", "transaction_type": "BUY", "variety": "regular", "product": "CNC", "order_type": "MARKET", "quantity": 1, "price": 0, "trigger_price": 0 } ]'

response ='', headers=headers, data=data)
I get 'Response [400]' error when I execute the above. What is the error?
  • rakeshr
    Everything seems to be correct. Can you print the response text and paste it here?
  • neel2323
    Hi Rakesh!

    I was new to using Response command and hence when I used to print response I used to get Response [400]. Worked when I did response.text. Thank you!
This discussion has been closed.