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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: payrex-python
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: PayRex Python Library
5
5
  Home-page: https://github.com/payrexhq/payrex-python
6
6
  Author: PayRex
@@ -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.status_code != 200:
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
- json_response_body = response.json()
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: payrex-python
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: PayRex Python Library
5
5
  Home-page: https://github.com/payrexhq/payrex-python
6
6
  Author: PayRex
@@ -7,7 +7,6 @@ payrex/client.py
7
7
  payrex/config.py
8
8
  payrex/error.py
9
9
  payrex/http_client.py
10
- payrex/services/service_factory.py
11
10
  payrex_python.egg-info/PKG-INFO
12
11
  payrex_python.egg-info/SOURCES.txt
13
12
  payrex_python.egg-info/dependency_links.txt
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
 
4
4
  setup(
5
5
  name='payrex-python',
6
- version='0.1.0',
6
+ version='0.1.2',
7
7
  author='PayRex',
8
8
  author_email='support@payrexhq.com',
9
9
  description='PayRex Python Library',
@@ -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