①先配置,方法同数据解析入库(https://www.cnblogs.com/gkdata/p/17792339.html)
②生成python代码
import sys sys.path.append( r'D:\安装包\GKData\ApiConfig') import Gk Gk.Guid2DB_Path = r'"D:\安装包\GKData\3rdLibs\Guid2DB.exe" ' _headers_dict = { "Host": "compass.vip.com", "Connection": "keep-alive", "Content-Length": "119", "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"", "Accept": "application/json, text/plain, */*", "Content-Type": "application/json", "sec-ch-ua-mobile": "?0", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", "sec-ch-ua-platform": "\"Windows\"", "Origin": "https://compass.vip.com", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Referer": "https://compass.vip.com/frontend/index.html", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9", "Cookie": "supplier_status_key=2018-02-25; PHPSESSID=5a4lgogrgl04u4bth7fhrhut33; vipshop_passport_src=https%3A%2F%2Fvis.vip.com%2FnewloginPassport.php; mars_pid=0; mars_sid=e998736f8e25821434821f024bc3080a; visit_id=AB237EC3C733C9E37F4965B0E1F37FA6; pg_session_no=1; vip_tracker_source_from=; B_TOKEN_VC=98D8C683DB9419EBA1135BFF4897767FFECDCBB1; VipRUID_VC=196172884; vc_token=eyJ0b2tlbiI6IjI3MDRjMzk5NjMwZDFkNTQzMGU4OTdiNTY5MGY5NDQ2IiwidG9rZW4xIjoiNzU0YWExNTYzNjgyNjUyYWEzZTg1MzFkZjlkMjdmYWYiLCJ2ZW5kb3JJZCI6IjI1OTE2IiwidXNlck5hbWUiOiJzdW55YW55dUBtaWlvdy5jb20uY24iLCJ2ZW5kb3JDb2RlIjoiNjEwOTg4IiwidXNlcklkIjoiMTY3Nzc4IiwidmlzU2Vzc2lvbklkIjoiNWE0bGdvZ3JnbDA0dTRidGg3ZmhyaHV0MzMiLCJhcHBOYW1lIjoidmlzUEMiLCJ2aXNpdEZyb20iOiJ2YyJ9; JSESSIONID=710B09D4A4927F4FCEA0EC3D0E6AD4C7-s1; compassV=2.4; tipInfoV=2.3; guideV=2.15; mars_cid=1690261356174_02be24b27550d1be62c45f65177e643e; user_id=167778; vendor_code=610988; vendor_name=%E5%AD%99%E8%89%B3%E9%9B%A8" } # 自动生成的代码,设置的新值会当作变量传入url _url = f'https://compass.vip.com/industry/industrySituation/queryIndustryMerRanking?'#.format() _post_data = { "startDt": "20230601", "endDt": "20230630", "brandStoreSn": "10001192", "categoryLevel": 1, "categoryId": 88859, "orderField": 1 } _post_data_string = Gk.json.dumps(_post_data) response = Gk.post_request(_url, _headers_dict, _post_data_string,True) print(response) Gk.Guid2DB( _url, _headers_dict, _post_data_string, response)
标签:魔方,--,com,data,python,vip,compass,post,Gk From: https://www.cnblogs.com/gkdata/p/17792426.html