Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON support to write() in HTTPSync for POST requests #1071 #1072

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HandelSM
Copy link

@HandelSM HandelSM commented Jan 9, 2025

…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 of HTTPSync.
The write() method now accepts a new optional boolean parameter is_data_json to 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 the json parameter of requests.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

  • Added the is_data_json parameter to the write() method.
  • When is_data_json=True, the payload is sent as JSON.
  • The default behavior (using data) remains unchanged for backward compatibility.

Checklist

  • Tested
  • Changelog updated
  • [/] Tests run and pass (same errors as in the bmoscon/cryptofeed/master branch, unrelated to this PR)
  • [/] Flake8 run and all errors/warnings resolved (same errors as in the bmoscon/cryptofeed/master branch, unrelated to this PR)
  • [x ] Contributors file updated (optional)

Related

Closes #1071

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a new parameter to write() in HTTPSync
1 participant