Skip to content

Commit f76bcb3

Browse files
author
Guillaume Badi
committed
fix put json
1 parent 8fcb63a commit f76bcb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mailjet/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def create(self, data=None, filters=None, id=None, action_id=None, **kwargs):
5151
return api_call(self._auth, 'post', self._url, headers=self.headers, resource_id=id, data=data, action=self.action, action_id=action_id, filters=filters, **kwargs)
5252

5353
def update(self, id, data, filters=None, action_id=None, **kwargs):
54+
if self.headers['Content-type'] == 'application/json':
55+
data = json.dumps(data)
5456
return api_call(self._auth, 'put', self._url, resource_id=id, headers=self.headers, data=data, action=self.action, action_id=action_id, filters=filters, **kwargs)
5557

5658
def delete(self, id, **kwargs):
@@ -84,8 +86,6 @@ def api_call(auth, method, url, headers, data=None, filters=None, resource_id=No
8486
try:
8587
response = req_method(url, data=data, params=filters, headers=headers, auth=auth,
8688
timeout=timeout, verify=False, stream=False)
87-
88-
# return parse_response(response, debug=debug)
8989
return response
9090

9191
except requests.exceptions.Timeout:

0 commit comments

Comments
 (0)