payrex-python 0.1.0__tar.gz → 0.1.2__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.
- {payrex_python-0.1.0 → payrex_python-0.1.2}/PKG-INFO +1 -1
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex/http_client.py +8 -2
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex_python.egg-info/PKG-INFO +1 -1
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex_python.egg-info/SOURCES.txt +0 -1
- {payrex_python-0.1.0 → payrex_python-0.1.2}/setup.py +1 -1
- payrex_python-0.1.0/payrex/services/service_factory.py +0 -28
- {payrex_python-0.1.0 → payrex_python-0.1.2}/LICENSE +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/README.md +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex/__init__.py +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex/api_resource.py +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex/client.py +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex/config.py +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex/error.py +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex_python.egg-info/dependency_links.txt +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex_python.egg-info/requires.txt +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/payrex_python.egg-info/top_level.txt +0 -0
- {payrex_python-0.1.0 → payrex_python-0.1.2}/setup.cfg +0 -0
|
@@ -28,13 +28,19 @@ class HttpClient:
|
|
|
28
28
|
|
|
29
29
|
response = requests.request(method, url, auth=auth, headers=headers, data=data)
|
|
30
30
|
|
|
31
|
-
if response.
|
|
31
|
+
if not response.content:
|
|
32
|
+
raise Exception(response)
|
|
33
|
+
|
|
34
|
+
if response.status_code < 200 or response.status_code >= 400:
|
|
32
35
|
self._handle_error(response)
|
|
33
36
|
|
|
34
37
|
return ApiResource(response.json())
|
|
35
38
|
|
|
36
39
|
def _handle_error(self, response):
|
|
37
|
-
|
|
40
|
+
try:
|
|
41
|
+
json_response_body = response.json()
|
|
42
|
+
except json.JSONDecodeError:
|
|
43
|
+
raise Exception(response.content)
|
|
38
44
|
|
|
39
45
|
if response.status_code == 400:
|
|
40
46
|
raise RequestInvalidException(json_response_body)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
|
|
3
|
-
from payrex import BaseService
|
|
4
|
-
from payrex import CheckoutSessionService
|
|
5
|
-
from payrex import MerchantService
|
|
6
|
-
from payrex import PaymentIntentService
|
|
7
|
-
from payrex import PaymentMethodService
|
|
8
|
-
from payrex import RefundService
|
|
9
|
-
from payrex import WebhookService
|
|
10
|
-
|
|
11
|
-
class ServiceFactory:
|
|
12
|
-
@staticmethod
|
|
13
|
-
def get(name):
|
|
14
|
-
service_name = ''.join(word.capitalize() for word in name.split('_'))
|
|
15
|
-
service_class = globals().get(service_name + 'Service')
|
|
16
|
-
|
|
17
|
-
if not isinstance(service_class, type):
|
|
18
|
-
raise ValueError(f'Unknown service: {name}')
|
|
19
|
-
|
|
20
|
-
return service_class
|
|
21
|
-
|
|
22
|
-
@staticmethod
|
|
23
|
-
def names():
|
|
24
|
-
return [
|
|
25
|
-
re.sub(r'(?<!^)(?=[A-Z])', '_', c.__name__.split('Service')[0]).lower()
|
|
26
|
-
|
|
27
|
-
for c in BaseService.__subclasses__()
|
|
28
|
-
]
|
|
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
|