MambuPy 2.3.1__tar.gz → 2.3.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.
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/__init__.py +1 -1
- {mambupy-2.3.1/mambupy → mambupy-2.3.2/MambuPy}/api/connector/rest.py +18 -5
- {mambupy-2.3.1/mambupy → mambupy-2.3.2/MambuPy}/api/entities.py +6 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy.egg-info/PKG-INFO +1 -1
- {mambupy-2.3.1 → mambupy-2.3.2}/PKG-INFO +1 -1
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/__init__.py +1 -1
- {mambupy-2.3.1/MambuPy → mambupy-2.3.2/mambupy}/api/connector/rest.py +18 -5
- {mambupy-2.3.1/MambuPy → mambupy-2.3.2/mambupy}/api/entities.py +6 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/LICENSE +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/classes.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/connector/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/connector/mambuconnector.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/interfaces.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambubranch.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambucentre.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambuclient.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambucustomfield.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambugroup.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambuloan.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambuproduct.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mamburole.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambustruct.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambutask.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambutransaction.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/mambuuser.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/api/vos.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/mambuconfig.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/mambugeturl.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/mambuutil.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_activities.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_addresses.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_branches.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_centres.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_clients.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_customfields.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_dummies.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_groups.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_loans.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_mambu.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_orm.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_tasks.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/orm/schema_users.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/rest/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/rest/mambuactivity.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/utils/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/utils/update_user_roles.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy/utils/userdeactivate.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy.egg-info/SOURCES.txt +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy.egg-info/dependency_links.txt +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy.egg-info/requires.txt +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/MambuPy.egg-info/top_level.txt +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/README.md +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/classes.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/connector/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/connector/mambuconnector.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/interfaces.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambubranch.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambucentre.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambuclient.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambucustomfield.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambugroup.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambuloan.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambuproduct.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mamburole.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambustruct.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambutask.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambutransaction.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/mambuuser.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/api/vos.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/mambuconfig.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/mambugeturl.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/mambuutil.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_activities.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_addresses.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_branches.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_centres.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_clients.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_customfields.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_dummies.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_groups.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_loans.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_mambu.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_orm.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_tasks.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/orm/schema_users.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/rest/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/rest/mambuactivity.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/utils/__init__.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/utils/update_user_roles.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/mambupy/utils/userdeactivate.py +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/pyproject.toml +0 -0
- {mambupy-2.3.1 → mambupy-2.3.2}/setup.cfg +0 -0
|
@@ -9,11 +9,14 @@ Currently supports REST.
|
|
|
9
9
|
|
|
10
10
|
import base64
|
|
11
11
|
import copy
|
|
12
|
+
import datetime
|
|
13
|
+
import enum
|
|
12
14
|
import json
|
|
13
15
|
import mimetypes
|
|
14
16
|
import os
|
|
15
17
|
import re
|
|
16
18
|
import uuid
|
|
19
|
+
from decimal import Decimal
|
|
17
20
|
|
|
18
21
|
import requests
|
|
19
22
|
from requests_toolbelt.multipart.encoder import MultipartEncoder
|
|
@@ -43,6 +46,19 @@ from MambuPy.mambuutil import (
|
|
|
43
46
|
logger = setup_logging(__name__)
|
|
44
47
|
|
|
45
48
|
|
|
49
|
+
class _MambuJSONEncoder(json.JSONEncoder):
|
|
50
|
+
"""JSON encoder that handles Python types not natively serializable by json.dumps."""
|
|
51
|
+
|
|
52
|
+
def default(self, obj):
|
|
53
|
+
if isinstance(obj, (datetime.datetime, datetime.date)):
|
|
54
|
+
return obj.isoformat()
|
|
55
|
+
if isinstance(obj, enum.Enum):
|
|
56
|
+
return obj.value
|
|
57
|
+
if isinstance(obj, Decimal):
|
|
58
|
+
return float(obj)
|
|
59
|
+
return super().default(obj)
|
|
60
|
+
|
|
61
|
+
|
|
46
62
|
def _configure_retry_strategy(session, retries=5):
|
|
47
63
|
"""Configure retry strategy for a session.
|
|
48
64
|
|
|
@@ -154,11 +170,8 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
|
|
|
154
170
|
return params
|
|
155
171
|
|
|
156
172
|
def __request_data(self, data):
|
|
157
|
-
if data
|
|
158
|
-
|
|
159
|
-
data = json.dumps(data)
|
|
160
|
-
except TypeError:
|
|
161
|
-
data = data
|
|
173
|
+
if isinstance(data, (dict, list)):
|
|
174
|
+
data = json.dumps(data, cls=_MambuJSONEncoder)
|
|
162
175
|
return data
|
|
163
176
|
|
|
164
177
|
def __request(self, method, url, params=None, data=None, content_type=None):
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import copy
|
|
9
|
+
import datetime
|
|
10
|
+
import enum
|
|
9
11
|
from importlib import import_module
|
|
10
12
|
import json
|
|
11
13
|
import time
|
|
@@ -503,6 +505,10 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
503
505
|
val = attrs[field]["value"]
|
|
504
506
|
except (TypeError, KeyError):
|
|
505
507
|
val = attrs[field]
|
|
508
|
+
if isinstance(val, (datetime.datetime, datetime.date)):
|
|
509
|
+
val = val.isoformat()
|
|
510
|
+
elif isinstance(val, enum.Enum):
|
|
511
|
+
val = val.value
|
|
506
512
|
return (operation, path, val)
|
|
507
513
|
|
|
508
514
|
def __patch_field_op(self, field, original_attrs):
|
|
@@ -9,11 +9,14 @@ Currently supports REST.
|
|
|
9
9
|
|
|
10
10
|
import base64
|
|
11
11
|
import copy
|
|
12
|
+
import datetime
|
|
13
|
+
import enum
|
|
12
14
|
import json
|
|
13
15
|
import mimetypes
|
|
14
16
|
import os
|
|
15
17
|
import re
|
|
16
18
|
import uuid
|
|
19
|
+
from decimal import Decimal
|
|
17
20
|
|
|
18
21
|
import requests
|
|
19
22
|
from requests_toolbelt.multipart.encoder import MultipartEncoder
|
|
@@ -43,6 +46,19 @@ from MambuPy.mambuutil import (
|
|
|
43
46
|
logger = setup_logging(__name__)
|
|
44
47
|
|
|
45
48
|
|
|
49
|
+
class _MambuJSONEncoder(json.JSONEncoder):
|
|
50
|
+
"""JSON encoder that handles Python types not natively serializable by json.dumps."""
|
|
51
|
+
|
|
52
|
+
def default(self, obj):
|
|
53
|
+
if isinstance(obj, (datetime.datetime, datetime.date)):
|
|
54
|
+
return obj.isoformat()
|
|
55
|
+
if isinstance(obj, enum.Enum):
|
|
56
|
+
return obj.value
|
|
57
|
+
if isinstance(obj, Decimal):
|
|
58
|
+
return float(obj)
|
|
59
|
+
return super().default(obj)
|
|
60
|
+
|
|
61
|
+
|
|
46
62
|
def _configure_retry_strategy(session, retries=5):
|
|
47
63
|
"""Configure retry strategy for a session.
|
|
48
64
|
|
|
@@ -154,11 +170,8 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
|
|
|
154
170
|
return params
|
|
155
171
|
|
|
156
172
|
def __request_data(self, data):
|
|
157
|
-
if data
|
|
158
|
-
|
|
159
|
-
data = json.dumps(data)
|
|
160
|
-
except TypeError:
|
|
161
|
-
data = data
|
|
173
|
+
if isinstance(data, (dict, list)):
|
|
174
|
+
data = json.dumps(data, cls=_MambuJSONEncoder)
|
|
162
175
|
return data
|
|
163
176
|
|
|
164
177
|
def __request(self, method, url, params=None, data=None, content_type=None):
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import copy
|
|
9
|
+
import datetime
|
|
10
|
+
import enum
|
|
9
11
|
from importlib import import_module
|
|
10
12
|
import json
|
|
11
13
|
import time
|
|
@@ -503,6 +505,10 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
503
505
|
val = attrs[field]["value"]
|
|
504
506
|
except (TypeError, KeyError):
|
|
505
507
|
val = attrs[field]
|
|
508
|
+
if isinstance(val, (datetime.datetime, datetime.date)):
|
|
509
|
+
val = val.isoformat()
|
|
510
|
+
elif isinstance(val, enum.Enum):
|
|
511
|
+
val = val.value
|
|
506
512
|
return (operation, path, val)
|
|
507
513
|
|
|
508
514
|
def __patch_field_op(self, field, original_attrs):
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|