Skip to content

Commit 9046136

Browse files
author
Guillaume Badi
committed
csv upload
1 parent 08363bf commit 9046136

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mailjet/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def get(self, id=None, filters=None, action_id=None, **kwargs):
4646
return self._get(id=id, filters=filters, **kwargs)
4747

4848
def create(self, data=None, filters=None, id=None, action_id=None, **kwargs):
49+
if self.headers['Content-type'] == 'application/json':
50+
data = json.dumps(data)
4951
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)
5052

5153
def update(self, id, data, filters=None, action_id=None, **kwargs):
@@ -79,10 +81,10 @@ def api_call(auth, method, url, headers, data=None, filters=None, resource_id=No
7981
url = build_url(url, method=method, action=action, resource_id=resource_id, action_id=action_id)
8082
req_method = getattr(requests, method)
8183

82-
# url = 'http://requestb.in/1fuplcz1'
84+
# url = 'http://requestb.in/1kbjidp1'
8385

8486
try:
85-
response = req_method(url, data=json.dumps(data), params=filters, headers=headers, auth=auth,
87+
response = req_method(url, data=data, params=filters, headers=headers, auth=auth,
8688
timeout=timeout, verify=False, stream=False)
8789

8890
# return parse_response(response, debug=debug)

0 commit comments

Comments
 (0)