Skip to content

Commit 0ff57a4

Browse files
committed
Pass action id, change build_url to accept both number and string
1 parent 9769fad commit 0ff57a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
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

0 commit comments

Comments
 (0)