huace-aigc-auth-client 1.1.10__tar.gz → 1.1.12__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.
- {huace_aigc_auth_client-1.1.10/huace_aigc_auth_client.egg-info → huace_aigc_auth_client-1.1.12}/PKG-INFO +1 -1
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/__init__.py +71 -9
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/legacy_adapter.py +3 -1
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/sdk.py +3 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/webhook.py +3 -1
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/webhook_flask.py +3 -1
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12/huace_aigc_auth_client.egg-info}/PKG-INFO +1 -1
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/pyproject.toml +1 -1
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/LICENSE +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/MANIFEST.in +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/QUICK_START.txt +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/README.md +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client.egg-info/SOURCES.txt +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client.egg-info/dependency_links.txt +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client.egg-info/requires.txt +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client.egg-info/top_level.txt +0 -0
- {huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/setup.cfg +0 -0
{huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/__init__.py
RENAMED
|
@@ -67,16 +67,76 @@ from .legacy_adapter import (
|
|
|
67
67
|
create_sync_config,
|
|
68
68
|
create_default_field_mappings,
|
|
69
69
|
)
|
|
70
|
+
# fastapi 相关功能是可选的,如果未安装 fastapi 则跳过
|
|
71
|
+
try:
|
|
72
|
+
from .webhook import (
|
|
73
|
+
register_webhook_router,
|
|
74
|
+
verify_webhook_signature,
|
|
75
|
+
)
|
|
76
|
+
_fastapi_available = True
|
|
77
|
+
except ImportError:
|
|
78
|
+
_fastapi_available = False
|
|
79
|
+
# 提供占位符,避免 __all__ 导出时出错
|
|
80
|
+
register_webhook_router = None
|
|
81
|
+
verify_webhook_signature = None
|
|
70
82
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
# Flask 相关功能是可选的,如果未安装 flask 则跳过
|
|
84
|
+
try:
|
|
85
|
+
from .webhook_flask import (
|
|
86
|
+
create_flask_webhook_blueprint,
|
|
87
|
+
register_flask_webhook_routes,
|
|
88
|
+
)
|
|
89
|
+
_flask_available = True
|
|
90
|
+
except ImportError:
|
|
91
|
+
_flask_available = False
|
|
92
|
+
# 提供占位符,避免 __all__ 导出时出错
|
|
93
|
+
create_flask_webhook_blueprint = None
|
|
94
|
+
register_flask_webhook_routes = None
|
|
95
|
+
|
|
96
|
+
def setLogger(log):
|
|
97
|
+
"""
|
|
98
|
+
统一设置所有模块的 logger
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
log: logging.Logger 实例
|
|
102
|
+
|
|
103
|
+
使用示例:
|
|
104
|
+
import logging
|
|
105
|
+
from huace_aigc_auth_client import setLogger
|
|
106
|
+
|
|
107
|
+
logger = logging.getLogger("my_app")
|
|
108
|
+
logger.setLevel(logging.INFO)
|
|
109
|
+
|
|
110
|
+
# 设置 SDK 所有模块使用该 logger
|
|
111
|
+
setLogger(logger)
|
|
112
|
+
"""
|
|
113
|
+
try:
|
|
114
|
+
from .sdk import setLogger as sdk_setLogger
|
|
115
|
+
sdk_setLogger(log)
|
|
116
|
+
except Exception as e:
|
|
117
|
+
print(f"Failed to set logger for sdk module: {e}")
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
from .legacy_adapter import setLogger as legacy_setLogger
|
|
121
|
+
legacy_setLogger(log)
|
|
122
|
+
except Exception as e:
|
|
123
|
+
print(f"Failed to set logger for legacy_adapter module: {e}")
|
|
124
|
+
|
|
125
|
+
if _fastapi_available:
|
|
126
|
+
try:
|
|
127
|
+
from .webhook import setLogger as webhook_setLogger
|
|
128
|
+
webhook_setLogger(log)
|
|
129
|
+
except Exception as e:
|
|
130
|
+
print(f"Failed to set logger for webhook module: {e}")
|
|
131
|
+
|
|
132
|
+
# 只在 flask 可用时设置 flask 模块的 logger
|
|
133
|
+
if _flask_available:
|
|
134
|
+
try:
|
|
135
|
+
from .webhook_flask import setLogger as webhook_flask_setLogger
|
|
136
|
+
webhook_flask_setLogger(log)
|
|
137
|
+
except Exception as e:
|
|
138
|
+
print(f"Failed to set logger for webhook_flask module: {e}")
|
|
75
139
|
|
|
76
|
-
from .webhook_flask import (
|
|
77
|
-
create_flask_webhook_blueprint,
|
|
78
|
-
register_flask_webhook_routes,
|
|
79
|
-
)
|
|
80
140
|
|
|
81
141
|
__all__ = [
|
|
82
142
|
# 核心类
|
|
@@ -105,5 +165,7 @@ __all__ = [
|
|
|
105
165
|
# Webhook 接收 (Flask)
|
|
106
166
|
"create_flask_webhook_blueprint",
|
|
107
167
|
"register_flask_webhook_routes",
|
|
168
|
+
# Logger 设置
|
|
169
|
+
"setLogger",
|
|
108
170
|
]
|
|
109
|
-
__version__ = "1.1.
|
|
171
|
+
__version__ = "1.1.12"
|
{huace_aigc_auth_client-1.1.10 → huace_aigc_auth_client-1.1.12}/huace_aigc_auth_client/webhook.py
RENAMED
|
@@ -13,7 +13,9 @@ from typing import Callable, Awaitable, Dict, Any, Optional
|
|
|
13
13
|
from fastapi import APIRouter, Request, HTTPException
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
|
-
|
|
16
|
+
def setLogger(log):
|
|
17
|
+
global logger
|
|
18
|
+
logger = log
|
|
17
19
|
|
|
18
20
|
def verify_webhook_signature(payload: bytes, signature: str, secret: str) -> bool:
|
|
19
21
|
"""
|
|
@@ -14,7 +14,9 @@ from typing import Callable, Dict, Any, Optional
|
|
|
14
14
|
from flask import Blueprint, request, jsonify
|
|
15
15
|
|
|
16
16
|
logger = logging.getLogger(__name__)
|
|
17
|
-
|
|
17
|
+
def setLogger(log):
|
|
18
|
+
global logger
|
|
19
|
+
logger = log
|
|
18
20
|
|
|
19
21
|
def verify_webhook_signature(payload: bytes, signature: str, secret: str) -> bool:
|
|
20
22
|
"""
|
|
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
|