python-amcards 1.3.2__tar.gz → 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_amcards-1.3.2 → python_amcards-1.3.3}/PKG-INFO +1 -1
- {python_amcards-1.3.2 → python_amcards-1.3.3}/amcards/amcards.py +21 -7
- {python_amcards-1.3.2 → python_amcards-1.3.3}/python_amcards.egg-info/PKG-INFO +1 -1
- {python_amcards-1.3.2 → python_amcards-1.3.3}/setup.py +1 -1
- {python_amcards-1.3.2 → python_amcards-1.3.3}/LICENSE +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/README.rst +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/amcards/__helpers.py +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/amcards/__init__.py +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/amcards/exceptions.py +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/amcards/models.py +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/python_amcards.egg-info/SOURCES.txt +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/python_amcards.egg-info/dependency_links.txt +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/python_amcards.egg-info/requires.txt +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/python_amcards.egg-info/top_level.txt +0 -0
- {python_amcards-1.3.2 → python_amcards-1.3.3}/setup.cfg +0 -0
|
@@ -119,7 +119,9 @@ class AMcardsClient:
|
|
|
119
119
|
|
|
120
120
|
res = requests.get(url=f'{DOMAIN}/.api/v1/credittransaction/', headers=self._HEADERS, params=params)
|
|
121
121
|
if not res.ok:
|
|
122
|
-
|
|
122
|
+
if res.status_code == 401:
|
|
123
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
124
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching credit transactions. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
123
125
|
|
|
124
126
|
credit_transactions_json = res.json().get('objects', [])
|
|
125
127
|
return [CreditTransaction._from_json(credit_transaction_json) for credit_transaction_json in credit_transactions_json]
|
|
@@ -143,7 +145,9 @@ class AMcardsClient:
|
|
|
143
145
|
|
|
144
146
|
res = requests.get(url=f'{DOMAIN}/.api/v1/credittransaction/', headers=self._HEADERS, params=params)
|
|
145
147
|
if not res.ok:
|
|
146
|
-
|
|
148
|
+
if res.status_code == 401:
|
|
149
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
150
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching credit transaction count. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
147
151
|
|
|
148
152
|
return res.json()['meta']['total_count']
|
|
149
153
|
|
|
@@ -161,7 +165,9 @@ class AMcardsClient:
|
|
|
161
165
|
"""
|
|
162
166
|
res = requests.get(url=f'{DOMAIN}/.api/v1/template/', headers=self._HEADERS, params={'limit': limit, 'offset': skip})
|
|
163
167
|
if not res.ok:
|
|
164
|
-
|
|
168
|
+
if res.status_code == 401:
|
|
169
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
170
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching templates. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
165
171
|
|
|
166
172
|
templates_json = res.json().get('objects', [])
|
|
167
173
|
return [Template._from_json(template_json) for template_json in templates_json]
|
|
@@ -201,7 +207,9 @@ class AMcardsClient:
|
|
|
201
207
|
"""
|
|
202
208
|
res = requests.get(url=f'{DOMAIN}/.api/v1/quicksendtemplate/', headers=self._HEADERS, params={'limit': limit, 'offset': skip})
|
|
203
209
|
if not res.ok:
|
|
204
|
-
|
|
210
|
+
if res.status_code == 401:
|
|
211
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
212
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching quicksends. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
205
213
|
|
|
206
214
|
templates_json = res.json().get('objects', [])
|
|
207
215
|
return [Template._from_json(template_json) for template_json in templates_json]
|
|
@@ -241,7 +249,9 @@ class AMcardsClient:
|
|
|
241
249
|
"""
|
|
242
250
|
res = requests.get(url=f'{DOMAIN}/.api/v1/campaign/', headers=self._HEADERS, params={'limit': limit, 'offset': skip})
|
|
243
251
|
if not res.ok:
|
|
244
|
-
|
|
252
|
+
if res.status_code == 401:
|
|
253
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
254
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching campaigns. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
245
255
|
|
|
246
256
|
campaigns_json = res.json().get('objects', [])
|
|
247
257
|
return [Campaign._from_json(campaign_json) for campaign_json in campaigns_json]
|
|
@@ -289,7 +299,9 @@ class AMcardsClient:
|
|
|
289
299
|
|
|
290
300
|
res = requests.get(url=f'{DOMAIN}/.api/v1/card/', headers=self._HEADERS, params=params)
|
|
291
301
|
if not res.ok:
|
|
292
|
-
|
|
302
|
+
if res.status_code == 401:
|
|
303
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
304
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching cards. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
293
305
|
|
|
294
306
|
cards_json = res.json().get('objects', [])
|
|
295
307
|
return [Card._from_json(card_json) for card_json in cards_json]
|
|
@@ -334,7 +346,9 @@ class AMcardsClient:
|
|
|
334
346
|
|
|
335
347
|
res = requests.get(url=f'{DOMAIN}/.api/v1/card/', headers=self._HEADERS, params=params)
|
|
336
348
|
if not res.ok:
|
|
337
|
-
|
|
349
|
+
if res.status_code == 401:
|
|
350
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
351
|
+
raise exceptions.AMcardsException(f'Something went wrong when fetching card count. AMcards Status Code: {res.status_code}, AMcards Body: {res.text}.')
|
|
338
352
|
|
|
339
353
|
return res.json()['meta']['total_count']
|
|
340
354
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|