Can some Python expert help with this? Trying to fetch the order ID from Placed Order Response but unable to fetch Order_Id from the Python Dictionary.
Code:
try:
# Place order
PlaceOrderId = api_instance.place_order(body, api_version)
print(PlaceOrderId)
PlaceOrderId = PlaceOrderId[‘data’]
print(PlaceOrderId)
PlaceOrderId = PlaceOrderId[‘order_id’]
print(PlaceOrderId)
except ApiException as e:
print(“Exception when calling OrderApi->place_order: %s\n” % e)
Error:
{‘data’: {‘order_id’: ‘230924000001245’}, ‘status’: ‘success’}
Traceback (most recent call last):
File “C:\Users\umava\PycharmProjects\KiteConnect\Upstox_Soum_V2_Testing.py”, line 71, in
PlaceOrderId = PlaceOrderId[‘data’]
~~~~~~~~~~~~^^^^^^^^
TypeError: ‘PlaceOrderResponse’ object is not subscriptable
Process finished with exit code 1