请问要如何写advanced_filter呢?如下的写法会报错:
{‘statusCode’: 400, ‘message’: ‘Invalid field reveived: openid’, ‘requestId’: ‘fb4253c63d2e0f95511125d8120cc033’}
“”"
def find_user_by_wechat_openid(self, openid: str) -> Optional[dict]:
"""
通过微信 openid(通常存储于 identities.userIdInIdp)查找用户。
v3 下,通过 list_users(...) 并传入 advancedFilter。
try:
advanced_filter = [
{
"field": "openid",
"operator": "EQUAL",
"value": openid
}
]
# 调用 list_users
res = self._management_client.list_users(advanced_filter=advanced_filter)
if res and res.get("totalCount", 0) > 0:
return res["list"][0]
return None
except AuthingException as e:
print(f"[find_user_by_wechat_openid] 异常:{e.code}, {e.message}")
return None