请选择 进入手机版 | 继续访问电脑版

[Python] 联通查询话费教程Python源码

[复制链接]
查看2141 | 回复0 | 2021-10-5 14:04 | 显示全部楼层 |阅读模式
联通查询话费教程Python源码,下面分享代码:
  1. import requests
  2. import json

  3. def main():
  4.     requests_url = "https://weixin.10010js.com/app/charge/qryRealFee"
  5.     headers = {
  6.         "Host": "weixin.10010js.com",
  7.         "Content-Type": "application/json",
  8.         "Cache-Control": "no-cache",
  9.         "Content-Length": "23",
  10.         "Accept": "*/*",
  11.         "Referer": "https://weixin.10010js.com/actPage/activity/index28.html?",
  12.         "Accept-Language": "zh-cn",
  13.         "User-Agent": "Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36"
  14.     }
  15.     data = {
  16.         "phone": phone
  17.     }
  18.     response = requests.post(requests_url, headers=headers, data=json.dumps(data)).text
  19.     query = int(response)/100
  20.     print("\33[32m剩余余额:\33[0m%s" % query)
  21.      
  22. if __name__ == "__main__":
  23.     print("——"*20)
  24.     phone = str(input("\33[33m请输入待查询手机号:\33[0m"))
  25.     main()
复制代码
代码运行结果如图所示:

联通查询话费教程Python源码

联通查询话费教程Python源码

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-4-16