sycommon-python-lib 0.2.6a1__py3-none-any.whl → 0.2.6a2__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.
- sycommon/auth/wecom_ldap_service.py +9 -13
- {sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/METADATA +1 -1
- {sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/RECORD +6 -6
- {sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/WHEEL +0 -0
- {sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/top_level.txt +0 -0
|
@@ -271,24 +271,19 @@ class WeComLDAPService(metaclass=SingletonMeta):
|
|
|
271
271
|
async def _get_bot_access_token(self) -> str:
|
|
272
272
|
"""获取用于 open_userid 解码的 access_token
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
始终使用 WeComDecodeUserID 配置的凭据。
|
|
275
|
+
WeCom 通讯录 token 用于查用户/部门;
|
|
276
|
+
WeComDecodeUserID token 专用于 batch/openuserid_to_userid 解码。
|
|
276
277
|
"""
|
|
277
|
-
import os
|
|
278
278
|
from sycommon.config.Config import Config
|
|
279
279
|
|
|
280
|
-
is_dev = os.environ.get("IS_DEV") == "true"
|
|
281
280
|
config = Config().config.get("llm", {})
|
|
282
|
-
|
|
283
|
-
if is_dev:
|
|
284
|
-
wecom_config = config.get("WeComDecodeUserID", {}) or config.get("WeCom", {})
|
|
285
|
-
else:
|
|
286
|
-
wecom_config = config.get("WeCom", {})
|
|
281
|
+
wecom_config = config.get("WeComDecodeUserID", {})
|
|
287
282
|
|
|
288
283
|
corpid = wecom_config.get("corpid", "")
|
|
289
284
|
corpsecret = wecom_config.get("corpsecret", "")
|
|
290
285
|
if not corpid or not corpsecret:
|
|
291
|
-
raise ValueError("解码凭据配置不完整,需要配置 llm.WeComDecodeUserID
|
|
286
|
+
raise ValueError("解码凭据配置不完整,需要配置 llm.WeComDecodeUserID")
|
|
292
287
|
|
|
293
288
|
url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken"
|
|
294
289
|
params = {"corpid": corpid, "corpsecret": corpsecret}
|
|
@@ -375,10 +370,11 @@ class WeComLDAPService(metaclass=SingletonMeta):
|
|
|
375
370
|
async def _get_wecom_user(self, userid: str) -> Optional[dict]:
|
|
376
371
|
"""获取单个企微用户详情
|
|
377
372
|
|
|
378
|
-
|
|
379
|
-
|
|
373
|
+
始终使用 WeCom 通讯录 token 查询用户详情。
|
|
374
|
+
注意:WeComDecodeUserID token 只能用于 open_userid 解码,
|
|
375
|
+
不能查 /cgi-bin/user/get(会返回 errcode 60111)。
|
|
380
376
|
"""
|
|
381
|
-
token = await self.
|
|
377
|
+
token = await self._get_access_token()
|
|
382
378
|
url = f"https://qyapi.weixin.qq.com/cgi-bin/user/get"
|
|
383
379
|
async with aiohttp.ClientSession() as session:
|
|
384
380
|
async with session.get(url, params={"access_token": token, "userid": userid}) as resp:
|
|
@@ -147,7 +147,7 @@ sycommon/auth/ldap_service.py,sha256=fOcpVov5LWJkBk62qbTaltks1c4la7JsbD104KfdBOI
|
|
|
147
147
|
sycommon/auth/oa_cache.py,sha256=u673y-mK-xo24pSqvfjL68_YFASO2zoxd_iAQ0HetCo,3491
|
|
148
148
|
sycommon/auth/oa_crypto.py,sha256=xpY1R1Bj3KLENXB0TuThB6Eku1E9PYjcoSpOdgDmCgc,1898
|
|
149
149
|
sycommon/auth/oa_service.py,sha256=kLepV9zgqpZoaB73DRPpMA5tJJQjoaDtQPdzBcGXeak,6235
|
|
150
|
-
sycommon/auth/wecom_ldap_service.py,sha256=
|
|
150
|
+
sycommon/auth/wecom_ldap_service.py,sha256=8mCOClbdlvky58ISXmV4UfSfUF0aWmPWykACNgjgfTg,30488
|
|
151
151
|
sycommon/config/Config.py,sha256=J5VjolqHmhYTBZwTyfSHv9X5cHMfN6kqY2ryHF4LJPw,6785
|
|
152
152
|
sycommon/config/DatabaseConfig.py,sha256=ILiUuYT9_xJZE2W-RYuC3JCt_YLKc1sbH13-MHIOPhg,804
|
|
153
153
|
sycommon/config/ElasticsearchConfig.py,sha256=fO9ZPMgJxSg1-UyDJ90wO6UvYy-jscwPJsSkXgx9qTU,2308
|
|
@@ -282,8 +282,8 @@ sycommon/tools/syemail.py,sha256=BDFhgf7WDOQeTcjxJEQdu0dQhnHFPO_p3eI0-Ni3LhQ,561
|
|
|
282
282
|
sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
|
|
283
283
|
sycommon/xxljob/__init__.py,sha256=7eoBlQxv-B39IfRSCY2bkqdGYs1QRe1umAWd88VMEEM,86
|
|
284
284
|
sycommon/xxljob/xxljob_service.py,sha256=JIEJaGXhqrTLcyxlyynSrsHg9bBnDNzX-D4qIWLRPUE,6815
|
|
285
|
-
sycommon_python_lib-0.2.
|
|
286
|
-
sycommon_python_lib-0.2.
|
|
287
|
-
sycommon_python_lib-0.2.
|
|
288
|
-
sycommon_python_lib-0.2.
|
|
289
|
-
sycommon_python_lib-0.2.
|
|
285
|
+
sycommon_python_lib-0.2.6a2.dist-info/METADATA,sha256=Utz4dW5hwd9N97fayxjevOMQ-wweDQZ2H_YdlsJmKl4,7913
|
|
286
|
+
sycommon_python_lib-0.2.6a2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
287
|
+
sycommon_python_lib-0.2.6a2.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
|
|
288
|
+
sycommon_python_lib-0.2.6a2.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
|
|
289
|
+
sycommon_python_lib-0.2.6a2.dist-info/RECORD,,
|
|
File without changes
|
{sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{sycommon_python_lib-0.2.6a1.dist-info → sycommon_python_lib-0.2.6a2.dist-info}/top_level.txt
RENAMED
|
File without changes
|