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.
Files changed (38) hide show
  1. {rainycode-1.5.2 → rainycode-1.5.4}/PKG-INFO +2 -1
  2. {rainycode-1.5.2 → rainycode-1.5.4}/common_base/aiorequests.py +13 -4
  3. {rainycode-1.5.2 → rainycode-1.5.4}/pyproject.toml +2 -1
  4. {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/PKG-INFO +2 -1
  5. {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/requires.txt +1 -0
  6. {rainycode-1.5.2 → rainycode-1.5.4}/common_base/consts.py +0 -0
  7. {rainycode-1.5.2 → rainycode-1.5.4}/common_base/exception.py +0 -0
  8. {rainycode-1.5.2 → rainycode-1.5.4}/common_base/logging.py +0 -0
  9. {rainycode-1.5.2 → rainycode-1.5.4}/common_base/response.py +0 -0
  10. {rainycode-1.5.2 → rainycode-1.5.4}/common_depends/auth_depend.py +0 -0
  11. {rainycode-1.5.2 → rainycode-1.5.4}/common_models/__init__.py +0 -0
  12. {rainycode-1.5.2 → rainycode-1.5.4}/common_models/base_model.py +0 -0
  13. {rainycode-1.5.2 → rainycode-1.5.4}/common_models/file_model.py +0 -0
  14. {rainycode-1.5.2 → rainycode-1.5.4}/common_models/user_model.py +0 -0
  15. {rainycode-1.5.2 → rainycode-1.5.4}/common_models/wechat_model.py +0 -0
  16. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/api/auth_api.py +0 -0
  17. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/api/wechat_api.py +0 -0
  18. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/router.py +0 -0
  19. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/schemas/auth_schema.py +0 -0
  20. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/service/auth_svc.py +0 -0
  21. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/service/file_svc.py +0 -0
  22. {rainycode-1.5.2 → rainycode-1.5.4}/common_servers/service/wechat_svc.py +0 -0
  23. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/bcrypt_util.py +0 -0
  24. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/captcha_util.py +0 -0
  25. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/datetime_util.py +0 -0
  26. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/ip_util.py +0 -0
  27. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/jwt_util.py +0 -0
  28. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/snowflake_util.py +0 -0
  29. {rainycode-1.5.2 → rainycode-1.5.4}/common_utils/wechat_util.py +0 -0
  30. {rainycode-1.5.2 → rainycode-1.5.4}/core/base_config.py +0 -0
  31. {rainycode-1.5.2 → rainycode-1.5.4}/core/databases/aiodb.py +0 -0
  32. {rainycode-1.5.2 → rainycode-1.5.4}/core/databases/aioredis.py +0 -0
  33. {rainycode-1.5.2 → rainycode-1.5.4}/core/middleware/http_middleware.py +0 -0
  34. {rainycode-1.5.2 → rainycode-1.5.4}/core/start.py +0 -0
  35. {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/SOURCES.txt +0 -0
  36. {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/dependency_links.txt +0 -0
  37. {rainycode-1.5.2 → rainycode-1.5.4}/rainycode.egg-info/top_level.txt +0 -0
  38. {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.2
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
- # 模块级别连接池,跨请求复用 keep-alive 长连接(而非每次新建 connector)
10
+ # 连接池:跨请求复用 keep-alive 长连接(而非每次新建 connector)。
11
11
  # limit: 全池同时最大连接数(含活跃与 keep-alive 空闲复用)
12
12
  # limit_per_host: 单个 host 端点同时最大连接数,限制对单一对端的并发/占用
13
- _CONNECTOR = aiohttp.TCPConnector(ssl=_SSL_CONTEXT, limit=300, limit_per_host=100)
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=_CONNECTOR, trust_env=True) as session,
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=_CONNECTOR, trust_env=True) as session,
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.2"
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.2
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"
@@ -12,6 +12,7 @@ pycryptodome==3.23.0
12
12
  uvicorn[standard]==0.41.0
13
13
  tortoise-orm[asyncmy]==0.25.4
14
14
  pydantic-settings==2.13.1
15
+ python-multipart==0.0.32
15
16
 
16
17
  [release]
17
18
  build==1.4.0
File without changes
File without changes
File without changes