Python並發請求requeste


    import grequests   #這個包要放到文件最頂部的導入

req_list = [] for x in range(100): headers = {"Content-Type": "application/json", 'Connection': 'close'} url = "http://" + ip + ":" + port + "/xxxx" data = {"time": 0, "time1": "xxxxxxxxxxxx", "time2": 4} req = grequests.post(url, json=data, headers=headers, verify=False) req_list.append(req) res_list = grequests.map(req_list)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM