Add JSON support to write() in HTTPSync for POST requests #1071
#1072
+8
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…loads (#1071)
Description of code - what bug does this fix / what feature does this add?
This PR adds support for sending JSON payloads in the
write()method ofHTTPSync.The
write()method now accepts a new optional boolean parameteris_data_jsonto specify if the data should be sent as JSON.Problem
As described in issue #1071, the
write()method does not allow sending payloads as JSON using thejsonparameter ofrequests.post. This functionality is required for HyperLiquid and could be benefitial for other new exchange implementations, where requests to the info endpoint are POST requests with a JSON body.Solution
is_data_jsonparameter to thewrite()method.is_data_json=True, the payload is sent as JSON.data) remains unchanged for backward compatibility.Checklist
bmoscon/cryptofeed/masterbranch, unrelated to this PR)bmoscon/cryptofeed/masterbranch, unrelated to this PR)Related
Closes #1071