rainycode 1.5.2__tar.gz → 1.5.4__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.
- {rainycode-1.5.2 → rainycode-1.5.4}/PKG-INFO +2 -1
- {rainycode-1.5.2 → rainycode-1.5.4}/common_base/aiorequests.py +13 -4
- {rainycode-1.5.2 → rainycode-1.5.4}/pyproject.toml +2 -1
- {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/PKG-INFO +2 -1
- {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/requires.txt +1 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_base/consts.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_base/exception.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_base/logging.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_base/response.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_depends/auth_depend.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_models/__init__.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_models/base_model.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_models/file_model.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_models/user_model.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_models/wechat_model.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/api/auth_api.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/api/wechat_api.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/router.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/schemas/auth_schema.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/service/auth_svc.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/service/file_svc.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/service/wechat_svc.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/bcrypt_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/captcha_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/datetime_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/ip_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/jwt_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/snowflake_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/wechat_util.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/core/base_config.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/core/databases/aiodb.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/core/databases/aioredis.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/core/middleware/http_middleware.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/core/start.py +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/SOURCES.txt +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/dependency_links.txt +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/top_level.txt +0 -0
- {rainycode-1.5.2 → rainycode-1.5.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rainycode
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.4
|
|
4
4
|
Summary: FastAPI base modules
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: aerich==0.9.2
|
|
@@ -17,6 +17,7 @@ Requires-Dist: pycryptodome==3.23.0
|
|
|
17
17
|
Requires-Dist: uvicorn[standard]==0.41.0
|
|
18
18
|
Requires-Dist: tortoise-orm[asyncmy]==0.25.4
|
|
19
19
|
Requires-Dist: pydantic-settings==2.13.1
|
|
20
|
+
Requires-Dist: python-multipart==0.0.32
|
|
20
21
|
Provides-Extra: release
|
|
21
22
|
Requires-Dist: build==1.4.0; extra == "release"
|
|
22
23
|
Requires-Dist: twine==6.1.0; extra == "release"
|
|
@@ -7,10 +7,19 @@ import certifi
|
|
|
7
7
|
# 模块级别 SSL 上下文,使用 certifi 证书,避免重复创建
|
|
8
8
|
_SSL_CONTEXT = ssl.create_default_context(cafile=certifi.where())
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# 连接池:跨请求复用 keep-alive 长连接(而非每次新建 connector)。
|
|
11
11
|
# limit: 全池同时最大连接数(含活跃与 keep-alive 空闲复用)
|
|
12
12
|
# limit_per_host: 单个 host 端点同时最大连接数,限制对单一对端的并发/占用
|
|
13
|
-
|
|
13
|
+
# 惰性初始化:TCPConnector 构造需要运行中的事件循环,只能在首次请求(async 上下文)时创建,
|
|
14
|
+
# 不能在模块 import 时同步 create(否则抛 RuntimeError: no running event loop)。
|
|
15
|
+
_CONNECTOR: aiohttp.TCPConnector | None = None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_connector() -> aiohttp.TCPConnector:
|
|
19
|
+
global _CONNECTOR
|
|
20
|
+
if _CONNECTOR is None:
|
|
21
|
+
_CONNECTOR = aiohttp.TCPConnector(ssl=_SSL_CONTEXT, limit=300, limit_per_host=100)
|
|
22
|
+
return _CONNECTOR
|
|
14
23
|
|
|
15
24
|
|
|
16
25
|
def parse_url(url, params=None, suffix=None):
|
|
@@ -28,7 +37,7 @@ def parse_url(url, params=None, suffix=None):
|
|
|
28
37
|
async def get(url, params=None, headers=None, suffix=None):
|
|
29
38
|
url = parse_url(url, params, suffix)
|
|
30
39
|
async with (
|
|
31
|
-
aiohttp.ClientSession(connector=
|
|
40
|
+
aiohttp.ClientSession(connector=_get_connector(), trust_env=True) as session,
|
|
32
41
|
session.get(url, headers=headers) as response,
|
|
33
42
|
):
|
|
34
43
|
text = await response.text()
|
|
@@ -39,7 +48,7 @@ async def post(url, data=None, headers=None):
|
|
|
39
48
|
if isinstance(data, dict):
|
|
40
49
|
data = json.dumps(data)
|
|
41
50
|
async with (
|
|
42
|
-
aiohttp.ClientSession(connector=
|
|
51
|
+
aiohttp.ClientSession(connector=_get_connector(), trust_env=True) as session,
|
|
43
52
|
session.post(url, data=data, headers=headers) as response,
|
|
44
53
|
):
|
|
45
54
|
text = await response.text()
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rainycode"
|
|
7
|
-
version = "1.5.
|
|
7
|
+
version = "1.5.4"
|
|
8
8
|
description = "FastAPI base modules"
|
|
9
9
|
requires-python = ">=3.10"
|
|
10
10
|
|
|
@@ -23,6 +23,7 @@ dependencies = [
|
|
|
23
23
|
"uvicorn[standard] == 0.41.0",
|
|
24
24
|
"tortoise-orm[asyncmy] == 0.25.4",
|
|
25
25
|
"pydantic-settings == 2.13.1",
|
|
26
|
+
"python-multipart==0.0.32"
|
|
26
27
|
]
|
|
27
28
|
|
|
28
29
|
[project.optional-dependencies]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rainycode
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.4
|
|
4
4
|
Summary: FastAPI base modules
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: aerich==0.9.2
|
|
@@ -17,6 +17,7 @@ Requires-Dist: pycryptodome==3.23.0
|
|
|
17
17
|
Requires-Dist: uvicorn[standard]==0.41.0
|
|
18
18
|
Requires-Dist: tortoise-orm[asyncmy]==0.25.4
|
|
19
19
|
Requires-Dist: pydantic-settings==2.13.1
|
|
20
|
+
Requires-Dist: python-multipart==0.0.32
|
|
20
21
|
Provides-Extra: release
|
|
21
22
|
Requires-Dist: build==1.4.0; extra == "release"
|
|
22
23
|
Requires-Dist: twine==6.1.0; extra == "release"
|
|
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
|