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

Function login

wxapp/quanmianshidai.py:430–454  ·  view source on GitHub ↗
(code, token)

Source from the content-addressed store, hash-verified

428
429
430def login(code, token): # 提取的号码
431 url = "https://sg01.purcotton.com/api/login"
432 headers = create_headers(code, token)
433 data = {
434 "invite_source": "task",
435 "channel": "" # "channel": "zmh_assist"
436 }
437
438 try:
439 response = requests.post(url, headers=headers, json=data)
440 response.raise_for_status() # 检查HTTP响应状态
441
442 response_data = response.json()
443 if response_data.get("code") == 200:
444 phone = response_data["data"]["phone"]
445 user_id = response_data["data"]["id"] # 提取id
446 #print("提取的电话号码:", phone)
447 #print("提取的用户ID:", user_id) # 打印id
448 return phone, user_id # 返回电话号码和用户ID
449 else:
450 print("请求失败,错误代码:", response_data.get("code"), "错误信息:", response_data.get("msg"))
451 return None, None
452 except requests.exceptions.RequestException as e:
453 print(f"请求失败: {e}")
454 return None, None
455
456# 提取数据 完
457

Callers 3

llhmpFunction · 0.70
cscscsFunction · 0.70
mainFunction · 0.70

Calls 4

create_headersFunction · 0.85
printFunction · 0.50
postMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected