Four methods in order.py hardcode "xml" in the final perform_request call, ignoring the resp_format kwarg passed by the caller:
- preview_equity_order (line 548)
- place_option_order (line 574)
- place_equity_order (line 619)
- place_option_order — the PUT variant (line 669)
e.g. place_equity_order, line 619
return self.perform_request(self.session.post, api_url, payload, "xml")
When a user passes resp_format="json", the request is still sent and parsed as XML via xmltodict. This means the response structure differs from what the JSON documentation shows (e.g.
single items become dicts instead of lists), and the resp_format parameter is effectively dead code in these methods.
Expected behavior: resp_format should be forwarded to perform_request, consistent with how other methods like list_order_details handle it.
Suggested fix:
return self.perform_request(
self.session.post, api_url, payload, kwargs.get("resp_format", "xml")
)
Found in pyetrade 2.1.1.
Four methods in order.py hardcode "xml" in the final perform_request call, ignoring the resp_format kwarg passed by the caller:
e.g. place_equity_order, line 619
return self.perform_request(self.session.post, api_url, payload, "xml")
When a user passes resp_format="json", the request is still sent and parsed as XML via xmltodict. This means the response structure differs from what the JSON documentation shows (e.g.
single items become dicts instead of lists), and the resp_format parameter is effectively dead code in these methods.
Expected behavior: resp_format should be forwarded to perform_request, consistent with how other methods like list_order_details handle it.
Suggested fix:
return self.perform_request(
self.session.post, api_url, payload, kwargs.get("resp_format", "xml")
)
Found in pyetrade 2.1.1.