MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / get_wx_code

Function get_wx_code

wxapp/BREO.py:91–105  ·  view source on GitHub ↗
(account_id)

Source from the content-addressed store, hash-verified

89 }
90
91def get_wx_code(account_id):
92 if not WX_AUTH:
93 raise RuntimeError("缺少wx_auth,无法从wx_server获取code")
94 resp = session.post(
95 f"{WX_SERVER_URL}/wx/code",
96 json={"appid": MINI_APP_ID, "openid": account_id},
97 headers=wx_headers(),
98 timeout=30,
99 )
100 resp.raise_for_status()
101 data = resp.json()
102 code = data.get("code") or (data.get("data") or {}).get("code")
103 if not code:
104 raise RuntimeError(f"wx_server未返回code: {data}")
105 return code
106
107def login_with_code(account_id):
108 code = get_wx_code(account_id)

Callers 1

login_with_codeFunction · 0.85

Calls 3

wx_headersFunction · 0.85
postMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected