How to get order id in Python

I want to cancel a order but I cant get the order id, I tried:

buy_order = buy(symbolTicker,qty,price) #buy is a function that I made (works ok)
result = client.cancel_order(
symbol=symbolTicker,
orderId=buy_order.get(‘OrderId’))

and return me Nonetype object has no attribute get
Anyone know how I can get it ?

Hi @Tomas_Marmay,

this is a programming question which is not exactly the intention on this forum (more focused on the API itself), but you should probably print buy_order to see if the saved data from the buy order is what you expect, should look similar to examples on https://binance-docs.github.io/apidocs/spot/en/#new-order-trade, then query “orderId”.

Ok sorry and thnk u