Skip to content

Commit 8cbda50

Browse files
committed
Add is_data_json flag to write method in HTTPSync to support JSON payloads (#1071)
1 parent 2b9d315 commit 8cbda50

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cryptofeed/connection.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ def read(self, address: str, params=None, headers=None, json=False, text=True, u
5656
r = requests.get(address, headers=headers, params=params)
5757
return self.process_response(r, address, json=json, text=text, uuid=uuid)
5858

59-
def write(self, address: str, data=None, json=False, text=True, uuid=None):
59+
def write(self, address: str, data=None, json=False, text=True, uuid=None, is_data_json=False):
6060
LOG.debug("HTTPSync: post to %s", address)
61-
r = requests.post(address, data=data)
61+
if (is_data_json):
62+
r = requests.post(address, json=data)
63+
else:
64+
r = requests.post(address, data=data)
65+
6266
return self.process_response(r, address, json=json, text=text, uuid=uuid)
6367

6468

0 commit comments

Comments
 (0)