cancelReplace no output partial fail

With cancelReplace, when Cancel Order Succeeds but New Order Placement Fails it does not output cancel-data as stated in Github docs. Instead it only throws an Error without the needed cancel-data:

Traceback (most recent call last):
  File "c:\Users\Pascal\Python Skripts\Binance\Binance.py", line 35, in <module>
    trade = client.cancel_and_replace(symbol=ticker, side='SELL', type= 'LIMIT_MAKER', cancelReplaceMode= 'ALLOW_FAILURE', quantity= 950, price= 0.7, cancelOrderId= 37359904)
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python310\lib\site-packages\binance\spot\trade.py", line 184, in cancel_and_replace
    return self.sign_request("POST", url_path, params)
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python310\lib\site-packages\binance\api.py", line 83, in sign_request
    return self.send_request(http_method, url_path, payload)
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python310\lib\site-packages\binance\api.py", line 117, in send_request
    self._handle_exception(response)
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python310\lib\site-packages\binance\api.py", line 170, in _handle_exception
    raise ClientError(status_code, err["code"], err["msg"], response.headers)
binance.error.ClientError: (409, -2021, 'Order cancel-replace partially failed.', {'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '562', 'Connection': 'keep-alive', 'Date': 'Tue, 15 Nov 2022 22:52:38 GMT', 'Server': 'nginx', 'x-mbx-uuid': '5abc70b8-6e7b-4008-a43e-760621393663', 'x-mbx-used-weight': '34', 'x-mbx-used-weight-1m': '34', 'x-mbx-order-count-10s': '1', 'x-mbx-order-count-1d': '17', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains', 'X-Frame-Options': 'SAMEORIGIN', 'X-Xss-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "default-src 'self'", 'X-Content-Security-Policy': "default-src 'self'", 'X-WebKit-CSP': "default-src 'self'", 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 0c792defeeaa18965559ad74895ea56a.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FRA60-P3', 'X-Amz-Cf-Id': 'eQX28Fk_LBpAlk017J8xjnPr6roldN-_grxxiuGwtFdcVPyYRkBLGQ=='})

If new order placement fails, i need the data returned from the successful cancel.
Thanks for your help!

Which library are you using?

The problem seems to be ClientError(status_code, err["code"], err["msg"], response.headers), i.e, it provides information on the error code and error message only, although, the response contains data field as well:

{
  "code": -2021,
  "msg": "Order cancel-replace partially failed.",
  "data": {}

It it’s GitHub - binance/binance-connector-python: a simple connector to Binance Public API, please open an issue on the repository for us to track down and do amends in the future.