吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2337|回复: 8
收起左侧

[Python 转载] 【初学练手】使用python获取风险城市

[复制链接]
cykablyat 发表于 2022-3-14 22:29
最近想知道全国有哪些城市是有风险地区的 但网上找到的会把具体地区也显示出来,看着太多了,于是自己动手写(gai)一个  ,因为本人是三天打鱼两天晒网的python菜鸡  ,所以代码写的很烂 各位还请多多指教。另外官方的数据接口做了加密,以我的水平那肯定是破不了的,所以解密方法参考(zhaoban)了论坛里@cflying  大佬在帖子[Python] [Python] 疫情等级查里发的的方法。
[Python] 纯文本查看 复制代码
import requests
import time
import hashlib


def main():
    url_ = "http://103.66.32.242:8005/zwfwMovePortal/interface/interfaceJson"
    timestamp_ = str(time.time())[:10]
    no256sign = str(timestamp_) + "23y0ufFl5YxIyGrI8hWRUZmKkvtSjLQA" + "123456789abcdefg" + str(timestamp_)
    signature = hashlib.sha256(no256sign.encode('utf-8')).hexdigest().upper()

    data_ =  {"appId": "NcApplication",
    "key": "3C502C97ABDA40D0A60FBEE50FAAD1DA",
    "nonceHeader": "123456789abcdefg",
    "paasHeader": "zdww",
    "signatureHeader": signature,
    "timestampHeader": str(timestamp_)}

    no256smt_sig = str(timestamp_) + "fTN2pfuisxTavbTuYVSsNJHetwq5bJvCQkjjtiLM2dCratiA"+str(timestamp_)
    smt_sig = hashlib.sha256(no256smt_sig.encode('utf-8')).hexdigest().upper()


    headers_ = {'x-wif-nonce': 'QkjjtiLM2dCratiA',
    'x-wif-paasid': 'smt-application',
    'x-wif-signature': smt_sig,
    'x-wif-timestamp': str(timestamp_),
    'Content-Type':"application/json; charset=UTF-8",
    }
    getedthings = requests.post(url_,json=data_,headers=headers_).json()
    '''print(str(getedthings))
    print(timestamp_)
    print(signature)'''
    highlist = []
    middlelist = []
    for items_ in getedthings['data']['highlist']:
        need_ = items_['province']+items_['city']
        highlist.append(need_)
        highlist = list(set(highlist))

    for items in getedthings['data']['middlelist']:
        need = items['province']+items['city']
        middlelist.append(need)
        middlelist = list(set(middlelist))
    
    print('高风险城市有:')
    for items in highlist:
        print(items)
    print("\n")
    print('中风险城市有:')
    for items in middlelist:
        print(items )

    pass

if __name__ == '__main__':
    main()
    input('press enter to exit')

免费评分

参与人数 3吾爱币 +3 热心值 +2 收起 理由
xiaolin1653 + 1 + 1 我很赞同!
tdm134 + 1 + 1 谢谢@Thanks!
ouyang9r + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

TakeKeyEasy 发表于 2022-3-15 01:03
收藏,后期来学习下
wsyishui 发表于 2022-3-15 11:01
rxxcy 发表于 2022-3-15 11:09
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 08:23

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表