huace-aigc-auth-client 1.1.27__tar.gz → 1.1.29__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 (19) hide show
  1. {huace_aigc_auth_client-1.1.27/huace_aigc_auth_client.egg-info → huace_aigc_auth_client-1.1.29}/PKG-INFO +1 -1
  2. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/__init__.py +7 -1
  3. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/api_stats_collector.py +7 -1
  4. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/sdk.py +1 -12
  5. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29/huace_aigc_auth_client.egg-info}/PKG-INFO +1 -1
  6. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/pyproject.toml +1 -1
  7. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/LICENSE +0 -0
  8. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/MANIFEST.in +0 -0
  9. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/QUICK_START.txt +0 -0
  10. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/README.md +0 -0
  11. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/legacy_adapter.py +0 -0
  12. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/user_context.py +0 -0
  13. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/webhook.py +0 -0
  14. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client/webhook_flask.py +0 -0
  15. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client.egg-info/SOURCES.txt +0 -0
  16. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client.egg-info/dependency_links.txt +0 -0
  17. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client.egg-info/requires.txt +0 -0
  18. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/huace_aigc_auth_client.egg-info/top_level.txt +0 -0
  19. {huace_aigc_auth_client-1.1.27 → huace_aigc_auth_client-1.1.29}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: huace-aigc-auth-client
3
- Version: 1.1.27
3
+ Version: 1.1.29
4
4
  Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
5
5
  Author-email: Huace <support@huace.com>
6
6
  License: MIT
@@ -123,6 +123,12 @@ def setLogger(log):
123
123
  legacy_setLogger(log)
124
124
  except Exception as e:
125
125
  print(f"Failed to set logger for legacy_adapter module: {e}")
126
+
127
+ try:
128
+ from .api_stats_collector import setLogger as api_stats_setLogger
129
+ api_stats_setLogger(log)
130
+ except Exception as e:
131
+ print(f"Failed to set logger for api_stats_collector module: {e}")
126
132
 
127
133
  if _fastapi_available:
128
134
  try:
@@ -172,4 +178,4 @@ __all__ = [
172
178
  # 用户上下文
173
179
  "get_current_user",
174
180
  ]
175
- __version__ = "1.1.27"
181
+ __version__ = "1.1.29"
@@ -6,9 +6,13 @@ import time
6
6
  import queue
7
7
  import threading
8
8
  import requests
9
+ import logging
9
10
  from typing import Optional, Dict, Any, List
10
11
  from datetime import datetime
11
-
12
+ logger = logging.getLogger(__name__)
13
+ def setLogger(log):
14
+ global logger
15
+ logger = log
12
16
 
13
17
  class ApiStatsCollector:
14
18
  """接口统计收集器(异步队列方式)"""
@@ -45,6 +49,7 @@ class ApiStatsCollector:
45
49
  self.worker_thread = None
46
50
 
47
51
  if self.enabled:
52
+ logger.info("启动 ApiStatsCollector 统计收集器")
48
53
  self.start()
49
54
 
50
55
  def start(self):
@@ -142,6 +147,7 @@ class ApiStatsCollector:
142
147
  if not buffer:
143
148
  return
144
149
 
150
+ logger.info(f"提交 {len(buffer)} 条接口统计数据")
145
151
  try:
146
152
  # 按token分组
147
153
  token_groups: Dict[str, List[Dict[str, Any]]] = {}
@@ -694,18 +694,7 @@ class AuthMiddleware:
694
694
  pass
695
695
  elif "multipart/form-data" in content_type:
696
696
  # 文件上传请求,不读取 body,避免损坏文件流
697
- # 只收集表单字段(非文件字段)
698
- try:
699
- form = await request.form()
700
- form_params = {}
701
- for k, v in form.items():
702
- if hasattr(v, "filename"):
703
- # 跳过文件字段
704
- continue
705
- form_params[k] = v
706
- params["form_params"] = form_params
707
- except Exception:
708
- pass
697
+ params["form_params"] = {"skipped_multipart": True}
709
698
  # 其他类型(如 application/octet-stream 等二进制流)直接跳过,不读取
710
699
 
711
700
  return params
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: huace-aigc-auth-client
3
- Version: 1.1.27
3
+ Version: 1.1.29
4
4
  Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
5
5
  Author-email: Huace <support@huace.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "huace-aigc-auth-client"
7
- version = "1.1.27"
7
+ version = "1.1.29"
8
8
  description = "华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"