| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- """Try different request body shapes for /sms/send."""
- import asyncio
- import sys
- from pathlib import Path
- _HERE = Path(__file__).resolve().parent
- sys.path.insert(0, str(_HERE.parent / "src"))
- from cq2_sdk.env_loader import load_env
- load_env(_HERE.parent / ".env")
- from cq2_sdk.login import Box996Login, ManualGeetestSolver
- HOST = "https://pc-api.996hezi.com"
- PATH = "/sms/send"
- # 4 个 body 变体: 加 game_id / sms_type / mobile 字段名 / type
- CANDIDATES = [
- ("with game_id=206923 + type=login", {
- "phone": "13800138000", "channel_id": "", "game_id": "206923",
- "inviter_uid": "", "needConfirmLogin": True, "type": "login",
- }),
- ("with game_id=206923 + sms_type=login", {
- "phone": "13800138000", "channel_id": "", "game_id": "206923",
- "inviter_uid": "", "needConfirmLogin": True, "sms_type": "login",
- }),
- ("with mobile (different field name) + game_id", {
- "mobile": "13800138000", "game_id": "206923",
- }),
- ("minimal: just phone + game_id", {
- "phone": "13800138000", "game_id": "206923",
- }),
- ]
- async def main() -> int:
- box = Box996Login(geetest=ManualGeetestSolver(), device_id="00:15:5d:0a:04:00")
- print(f"Trying 4 body shapes against {HOST}{PATH}:\n")
- for desc, body in CANDIDATES:
- try:
- r = await box._request("POST", HOST, PATH, json_body=body)
- print(f" [200] {desc:<48} code={r.get('code')} msg={r.get('msg', '')[:60]}")
- except Exception as e:
- from cq2_sdk.login.box_996 import Box996Error
- if isinstance(e, Box996Error):
- print(f" [4xx] {desc:<48} code={e.code} msg={e.msg[:60]}")
- else:
- print(f" [err] {desc:<48} {type(e).__name__}: {str(e)[:60]}")
- return 0
- if __name__ == "__main__":
- sys.exit(asyncio.run(main()))
|