Skip to content

Commit 9ab51e7

Browse files
author
gbadi
committed
user agent
1 parent 57dbb5b commit 9ab51e7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

mailjet/client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class Config(object):
1515

1616
def __getitem__(self, key):
1717
url = self.API_URL[0:]
18-
headers = {'Content-type': 'application/json'}
18+
headers = {'Content-type': 'application/json', 'User-agent': 'mailjet-apiv3-python'}
1919
if key.lower() == 'contactslist_csvdata':
2020
url = urljoin(url, 'DATA/')
21-
headers = {'Content-type': 'text/plain'}
21+
headers['Content-type'] = 'text/plain'
2222
elif key.lower() == 'batchjob_csverror':
2323
url = urljoin(url, 'DATA/')
24-
headers = {'Content-type': 'text/csv'}
24+
headers['Content-type'] = 'text/csv'
2525
elif key.lower() != 'send':
2626
url = urljoin(url, 'REST/')
2727
url = url + key.split('_')[0].lower()
@@ -81,8 +81,6 @@ def api_call(auth, method, url, headers, data=None, filters=None, resource_id=No
8181
url = build_url(url, method=method, action=action, resource_id=resource_id, action_id=action_id)
8282
req_method = getattr(requests, method)
8383

84-
# url = 'http://requestb.in/1kbjidp1'
85-
8684
try:
8785
response = req_method(url, data=data, params=filters, headers=headers, auth=auth,
8886
timeout=timeout, verify=False, stream=False)

0 commit comments

Comments
 (0)