页面爬取redis 实例数据
import requests cookie = "x-client-ssid=17e4c051cf7-9f0379ebd394dc133bf7d750ac6ea4ae4f88c84a;x-host-key-front=17e4c051d0b-75f9ceca09abf8f47fd229f4f7d3b7fe3d928519; x_host_key=17e4c051cfc-1ece45c5f3100d864f8136107e3cbde2f0082d4c; x-host-key-ngn=17e4c051cf7-4932c88ca9b71039fe5d8ebb966d4f849102a939; tce_language=zh-CN; user_id=p_xiaollhu; user_skey=37cd2d43c0535f510dc079c545c88f81; user_uin=909622668; owner_uin=909619400" heads = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36", "Cookie": cookie } data = {"Region":"njgov","OrderBy":"createtime","OrderType":0,"Offset":0,"Limit":20,"Status":[-2,-3,0,1,2],"mc_gtk":""} url = "http://redis-op.govcloud.tencent.com/api/server-cloud3/redis/DescribeInstances" html_data = requests.post(url,json=data,headers=heads) json_html = html_data.json() print(html_data.status_code) print(json_html['data']) num = len(json_html['data']['InstanceSet']) print(num)