sanic-api 0.4.0__py3-none-any.whl → 0.4.2__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.
- sanic_api/__init__.py +1 -1
- sanic_api/app.py +7 -3
- sanic_api/config/setting.py +2 -2
- {sanic_api-0.4.0.dist-info → sanic_api-0.4.2.dist-info}/METADATA +2 -1
- {sanic_api-0.4.0.dist-info → sanic_api-0.4.2.dist-info}/RECORD +8 -7
- sanic_api-0.4.2.dist-info/entry_points.txt +2 -0
- {sanic_api-0.4.0.dist-info → sanic_api-0.4.2.dist-info}/WHEEL +0 -0
- {sanic_api-0.4.0.dist-info → sanic_api-0.4.2.dist-info}/licenses/LICENSE.txt +0 -0
sanic_api/__init__.py
CHANGED
sanic_api/app.py
CHANGED
@@ -43,7 +43,7 @@ class BaseApp:
|
|
43
43
|
# 默认启用sanic_ext里面的后台日志记录器
|
44
44
|
motd_display = {"envornment": settings.envornment}
|
45
45
|
config = {"access_log": settings.access_log, "motd_display": motd_display}
|
46
|
-
if settings.mode == RunModeEnum.
|
46
|
+
if settings.mode == RunModeEnum.DEBUG:
|
47
47
|
config.update({"auto_reload": settings.auto_reload, "workers": 1, "debug": True})
|
48
48
|
else:
|
49
49
|
config.update({"fast": True, "auto_reload": False})
|
@@ -158,6 +158,7 @@ class BaseApp:
|
|
158
158
|
|
159
159
|
"""
|
160
160
|
# app.config.LOGGING = True
|
161
|
+
app.config.INSPECTOR = True
|
161
162
|
app.config.FALLBACK_ERROR_FORMAT = "json"
|
162
163
|
self._setup_cors(app)
|
163
164
|
|
@@ -185,7 +186,7 @@ class BaseApp:
|
|
185
186
|
|
186
187
|
"""
|
187
188
|
cors = ",".join(self.settings.cors.origins)
|
188
|
-
if self.settings.mode == RunModeEnum.
|
189
|
+
if self.settings.mode == RunModeEnum.DEBUG:
|
189
190
|
app.config.CORS_SEND_WILDCARD = True
|
190
191
|
app.config.CORS_SUPPORTS_CREDENTIALS = self.settings.cors.supports_credentials
|
191
192
|
app.config.CORS_ORIGINS = cors or "*"
|
@@ -221,7 +222,10 @@ class BaseApp:
|
|
221
222
|
retention=log_config.retention,
|
222
223
|
compression=log_config.compression,
|
223
224
|
loki_url=log_config.loki_url,
|
224
|
-
loki_labels={
|
225
|
+
loki_labels={
|
226
|
+
"application": self.name,
|
227
|
+
"envornment": self.settings.envornment,
|
228
|
+
},
|
225
229
|
)
|
226
230
|
Extend.register(log_ext)
|
227
231
|
|
sanic_api/config/setting.py
CHANGED
@@ -9,7 +9,7 @@ class RunModeEnum(EnumBase):
|
|
9
9
|
运行模式
|
10
10
|
"""
|
11
11
|
|
12
|
-
|
12
|
+
DEBUG = EnumField("debug", desc="开发模式")
|
13
13
|
PRODUCTION = EnumField("prod", desc="生产模式")
|
14
14
|
|
15
15
|
|
@@ -83,7 +83,7 @@ class DefaultSettings(SettingsBase):
|
|
83
83
|
port: int = Field(default=6969)
|
84
84
|
|
85
85
|
# 运行模式
|
86
|
-
mode: RunModeEnum = Field(default=RunModeEnum.
|
86
|
+
mode: RunModeEnum = Field(default=RunModeEnum.DEBUG)
|
87
87
|
|
88
88
|
# 运行环境,仅作为环境标识。
|
89
89
|
# 尽量不要使用这个字段去做逻辑判断。请使用mode去进行判断,因为测试环境、预发布环境、生产环境都应属于生产模式模式
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: sanic-api
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.2
|
4
4
|
Summary: Sanic 框架实用API工具集,拥有自动生成文档、参数校验、配置的导入、日志功能的优化等功能,更好的助力接口的开发
|
5
5
|
Project-URL: homepage, https://github.com/x-haose/sanic-api
|
6
6
|
Project-URL: repository, https://github.com/x-haose/sanic-api
|
@@ -19,6 +19,7 @@ Classifier: Operating System :: POSIX :: Linux
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
22
23
|
Classifier: Topic :: Internet :: WWW/HTTP
|
23
24
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
24
25
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
@@ -1,11 +1,11 @@
|
|
1
|
-
sanic_api/__init__.py,sha256=
|
2
|
-
sanic_api/app.py,sha256=
|
1
|
+
sanic_api/__init__.py,sha256=4shZ6RmXMVLTwDc1xuLKztP0449UXu8lErzjDPlX46s,75
|
2
|
+
sanic_api/app.py,sha256=axGuE2rmAUZdD2sFW1fqgH9agIItQ36AT4ondJ7xU-c,8594
|
3
3
|
sanic_api/api/__init__.py,sha256=MxQ7A-ALJOwznJviVt6zjhcIikhEJCKoOF-7c75qtpk,42
|
4
4
|
sanic_api/api/error.py,sha256=RikYhTFe_z0tv4nfksH4G6lzcwp5fWjNBC36xhFj-R4,661
|
5
5
|
sanic_api/api/model.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
sanic_api/api/request.py,sha256=CzltvJ8NE4UmnUTqGXJmJ7oRtBBT5GRcDADEnf7dkUE,7017
|
7
7
|
sanic_api/config/__init__.py,sha256=DVqXHMXANl_xUwBsLVYisr7ZPdX2ubA2_WH3GUZC-Bs,80
|
8
|
-
sanic_api/config/setting.py,sha256=
|
8
|
+
sanic_api/config/setting.py,sha256=N1o13lyDFHCq_mm_vwS-5PbpV79qXHW9hV5b3XzluQ0,3154
|
9
9
|
sanic_api/logger/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
sanic_api/logger/config.py,sha256=5C-kYrE13_cgw7vNxBwBLi4F8BijHakOKs6YSzxsEMA,3031
|
11
11
|
sanic_api/logger/extension.py,sha256=xj8DjGW3jN2M7MTu4mk65H1Qs-j5VwvgO0LGahoeQRU,4108
|
@@ -13,7 +13,8 @@ sanic_api/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
13
13
|
sanic_api/openapi/extension.py,sha256=HCrcEgrj63FXOhx6TJyJDaee6mDuVnuSMA5EtdYUVjc,1009
|
14
14
|
sanic_api/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
sanic_api/utils/enum.py,sha256=JGFh8o8kovcR4LF3ekuWJIiZINQspfeYrvVhmFvYK-I,1240
|
16
|
-
sanic_api-0.4.
|
17
|
-
sanic_api-0.4.
|
18
|
-
sanic_api-0.4.
|
19
|
-
sanic_api-0.4.
|
16
|
+
sanic_api-0.4.2.dist-info/METADATA,sha256=WZNnR_ys_0sALDJ0N2S8UAGgbW7w1zJtmWmQrwunnCA,4336
|
17
|
+
sanic_api-0.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
18
|
+
sanic_api-0.4.2.dist-info/entry_points.txt,sha256=PZcvOIZEHPvUeySs8R78X0mAxDM_EQGfpdqExppTiIM,45
|
19
|
+
sanic_api-0.4.2.dist-info/licenses/LICENSE.txt,sha256=T20w-F8AfuFO9CHy2mSk_An6T9eV4X4rGA01i-gp4M4,1090
|
20
|
+
sanic_api-0.4.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|