ul-api-utils 9.0.0a3__py3-none-any.whl → 9.0.0a4__py3-none-any.whl
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.
Potentially problematic release.
This version of ul-api-utils might be problematic. Click here for more details.
- ul_api_utils/modules/api_sdk.py +2 -2
- ul_api_utils/utils/json_encoder.py +11 -2
- {ul_api_utils-9.0.0a3.dist-info → ul_api_utils-9.0.0a4.dist-info}/METADATA +1 -1
- {ul_api_utils-9.0.0a3.dist-info → ul_api_utils-9.0.0a4.dist-info}/RECORD +8 -8
- {ul_api_utils-9.0.0a3.dist-info → ul_api_utils-9.0.0a4.dist-info}/LICENSE +0 -0
- {ul_api_utils-9.0.0a3.dist-info → ul_api_utils-9.0.0a4.dist-info}/WHEEL +0 -0
- {ul_api_utils-9.0.0a3.dist-info → ul_api_utils-9.0.0a4.dist-info}/entry_points.txt +0 -0
- {ul_api_utils-9.0.0a3.dist-info → ul_api_utils-9.0.0a4.dist-info}/top_level.txt +0 -0
ul_api_utils/modules/api_sdk.py
CHANGED
|
@@ -45,7 +45,7 @@ from ul_api_utils.utils.cached_per_request import cached_per_request
|
|
|
45
45
|
from ul_api_utils.utils.constants import TKwargs
|
|
46
46
|
from ul_api_utils.utils.jinja.t_url_for import t_url_for
|
|
47
47
|
from ul_api_utils.utils.jinja.to_pretty_json import to_pretty_json
|
|
48
|
-
from ul_api_utils.utils.json_encoder import
|
|
48
|
+
from ul_api_utils.utils.json_encoder import CustomJSONProvider, SocketIOJsonWrapper
|
|
49
49
|
from ul_api_utils.utils.load_modules import load_modules_by_template
|
|
50
50
|
from ul_api_utils.utils.uuid_converter import UUID4Converter
|
|
51
51
|
|
|
@@ -225,7 +225,7 @@ class ApiSdk:
|
|
|
225
225
|
)
|
|
226
226
|
self._flask_app_cache = flask_app
|
|
227
227
|
|
|
228
|
-
flask_app.
|
|
228
|
+
flask_app.json = CustomJSONProvider(flask_app) # type: ignore
|
|
229
229
|
|
|
230
230
|
flask_app.url_map.converters['uuid'] = UUID4Converter
|
|
231
231
|
|
|
@@ -7,6 +7,8 @@ from enum import Enum
|
|
|
7
7
|
from json import JSONEncoder
|
|
8
8
|
from typing import Dict, Any, Union, List, Optional, TYPE_CHECKING
|
|
9
9
|
from uuid import UUID
|
|
10
|
+
|
|
11
|
+
from flask.json.provider import DefaultJSONProvider
|
|
10
12
|
from frozendict import frozendict
|
|
11
13
|
from pydantic import BaseModel
|
|
12
14
|
|
|
@@ -78,8 +80,6 @@ class CustomJSONEncoder(JSONEncoder):
|
|
|
78
80
|
return str(obj.__html__())
|
|
79
81
|
|
|
80
82
|
if has_already_imported_db():
|
|
81
|
-
|
|
82
|
-
|
|
83
83
|
if isinstance(obj, DbBaseModel):
|
|
84
84
|
return obj.to_dict()
|
|
85
85
|
if isinstance(obj, Query) or isinstance(obj, DefaultMeta):
|
|
@@ -113,3 +113,12 @@ class SocketIOJsonWrapper:
|
|
|
113
113
|
@staticmethod
|
|
114
114
|
def loads(*args: Any, **kwargs: Any) -> Any:
|
|
115
115
|
return json.loads(*args, **kwargs)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class CustomJSONProvider(DefaultJSONProvider):
|
|
119
|
+
def __init__(self, app):
|
|
120
|
+
super().__init__(app)
|
|
121
|
+
self.encoder = CustomJSONEncoder()
|
|
122
|
+
|
|
123
|
+
def default(self, obj) -> Union[str, Dict[str, Any], List[Any], None]:
|
|
124
|
+
return self.encoder.default(obj)
|
|
@@ -65,7 +65,7 @@ ul_api_utils/internal_api/__tests__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQ
|
|
|
65
65
|
ul_api_utils/internal_api/__tests__/internal_api.py,sha256=X2iopeso6vryszeeA__lcqXQVtz3Nwt3ngH7M4OuN1U,1116
|
|
66
66
|
ul_api_utils/internal_api/__tests__/internal_api_content_type.py,sha256=mfiYPkzKtfZKFpi4RSnWAoCd6mRijr6sFsa2TF-s5t8,749
|
|
67
67
|
ul_api_utils/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
-
ul_api_utils/modules/api_sdk.py,sha256=
|
|
68
|
+
ul_api_utils/modules/api_sdk.py,sha256=BOQdHXzajmRW2tnGym-4PjLi_ypTn54KDJt3DaaUcss,26430
|
|
69
69
|
ul_api_utils/modules/api_sdk_config.py,sha256=ZUR48tIJeFlPJTSjyXzKfXaCKPtfqeaA0mlLX42SSFY,2137
|
|
70
70
|
ul_api_utils/modules/api_sdk_jwt.py,sha256=2XRfb0LxHUnldSL67S60v1uyoDpVPNaq4zofUtkeg88,15112
|
|
71
71
|
ul_api_utils/modules/intermediate_state.py,sha256=7ZZ3Sypbb8LaSfrVhaXaWRDnj8oyy26NUbmFK7vr-y4,1270
|
|
@@ -111,7 +111,7 @@ ul_api_utils/utils/deprecated.py,sha256=xR3ELgoDj7vJEY4CAYeEhdbtSJTfkukbjxcULtpM
|
|
|
111
111
|
ul_api_utils/utils/flags.py,sha256=AYN5nKWp4-uu6PSlPptL7ZiLqr3Pu-x5dffF6SBsqfg,957
|
|
112
112
|
ul_api_utils/utils/imports.py,sha256=i8PhoD0c_jnWTeXt_VxW_FihynwXSL_dHRT7jQiFyXE,376
|
|
113
113
|
ul_api_utils/utils/instance_checks.py,sha256=9punTfY5uabuJhmSGLfTgBqRderoFysCXBSI8rvbPco,467
|
|
114
|
-
ul_api_utils/utils/json_encoder.py,sha256=
|
|
114
|
+
ul_api_utils/utils/json_encoder.py,sha256=tLcO8da4iytj9sCzuD8hP7XO3qPujBmGbuhAOOX9vsI,4711
|
|
115
115
|
ul_api_utils/utils/load_modules.py,sha256=_CPmQuB6o_33FE6zFl_GyO5xS5gmjfNffB6k-cglKAA,685
|
|
116
116
|
ul_api_utils/utils/token_check.py,sha256=-Quuh8gOs9fNE1shYhdiMpQedafsLN7MB2ilSxG_F8E,489
|
|
117
117
|
ul_api_utils/utils/token_check_through_request.py,sha256=OyyObu6Btk9br7auIYvWcMULhNznNSD5T0mWOwZX7Uk,663
|
|
@@ -148,9 +148,9 @@ ul_api_utils/validators/validate_empty_object.py,sha256=3Ck_iwyJE_M5e7l6s1i88aqb
|
|
|
148
148
|
ul_api_utils/validators/validate_uuid.py,sha256=EfvlRirv2EW0Z6w3s8E8rUa9GaI8qXZkBWhnPs8NFrA,257
|
|
149
149
|
ul_api_utils/validators/__tests__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
150
|
ul_api_utils/validators/__tests__/test_custom_fields.py,sha256=20gLlnm1Ithsbbz3NIUXVAd92lW6YwVRSg_nETZhfaI,1442
|
|
151
|
-
ul_api_utils-9.0.
|
|
152
|
-
ul_api_utils-9.0.
|
|
153
|
-
ul_api_utils-9.0.
|
|
154
|
-
ul_api_utils-9.0.
|
|
155
|
-
ul_api_utils-9.0.
|
|
156
|
-
ul_api_utils-9.0.
|
|
151
|
+
ul_api_utils-9.0.0a4.dist-info/LICENSE,sha256=6Qo8OdcqI8aGrswJKJYhST-bYqxVQBQ3ujKdTSdq-80,1062
|
|
152
|
+
ul_api_utils-9.0.0a4.dist-info/METADATA,sha256=vJjbnlXj9JFJI9AhlxvB_Z1rVKR7I5Ih1EY8RhfCo7E,14714
|
|
153
|
+
ul_api_utils-9.0.0a4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
154
|
+
ul_api_utils-9.0.0a4.dist-info/entry_points.txt,sha256=8tL3ySHWTyJMuV1hx1fHfN8zumDVOCOm63w3StphkXg,53
|
|
155
|
+
ul_api_utils-9.0.0a4.dist-info/top_level.txt,sha256=1XsW8iOSFaH4LOzDcnNyxHpHrbKU3fSn-aIAxe04jmw,21
|
|
156
|
+
ul_api_utils-9.0.0a4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|