Skip to content

Commit 9c27c97

Browse files
authored
Fix action_id
Pass action id, change build_url to accept both number and string
2 parents 9769fad + c00ea4c commit 9c27c97

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

mailjet_rest/client.py

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

5353
def get_many(self, filters=None, action_id=None, **kwargs):
54-
return self._get(filters=filters, **kwargs)
54+
return self._get(filters=filters, action_id=action_id **kwargs)
5555

5656
def get(self, id=None, filters=None, action_id=None, **kwargs):
5757
return self._get(id=id, filters=filters, **kwargs)
@@ -79,9 +79,11 @@ def __init__(self, auth=None, **kwargs):
7979

8080
def __getattr__(self, name):
8181
split = name.split('_')
82+
#identify the resource
8283
fname = split[0]
8384
action = None
8485
if (len(split) > 1):
86+
#identify the sub resource (action)
8587
action = split[1]
8688
if action == 'csvdata':
8789
action = 'csvdata/text:plain'
@@ -129,7 +131,7 @@ def build_url(url, method, action=None, resource_id=None, action_id=None):
129131
if action:
130132
url += '/%s' % action
131133
if action_id:
132-
url += '/%d' % action_id
134+
url += '/{}'.format(action_id)
133135

134136
return url
135137

mailjet_rest/utils/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = (1, 3, 0)
1+
VERSION = (1, 3, 1)
22

33

44
def get_version(version=None):

test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_user_agent(self):
9090
auth=self.auth,
9191
version='v3.1'
9292
)
93-
self.assertEqual(self.client.config.user_agent, 'mailjet-apiv3-python/v1.3.0')
93+
self.assertEqual(self.client.config.user_agent, 'mailjet-apiv3-python/v1.3.1')
9494

9595

9696
if __name__ == '__main__':

0 commit comments

Comments
 (0)