import requests from mysql_db import MysqlDB headers_1 = {'content-type': "application/json", 'Authorization': 'APP appid = 4abf1a,token = 9480295ab2e2eddb8', 'dsNo': 'source1'} headers_2 = {'content-type': "application/json", 'Authorization': 'APP appid = 4abf1a,token = 9480295ab2e2eddb8', 'dsNo': 'source2', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, ' 'like Gecko) Chrome/86.0.4240.111 Safari/537.36', 'Host': '101.132.43.32:5308', 'POST': '/news/queryNewsByPage HTTP/1.1', 'Connection': 'keep-alive', 'Accept': 'application/json;charset=UTF-8' } if __name__ == '__main__': import time mysql = MysqlDB('marketing_db') url = "https://api-uat3.elaber.cn/elab-marketing-content/materialLabel/markingForMaterial" house = mysql.select('select a.id from house a LEFT JOIN brand_house_rlat b on a.id = b.house_id where a.status = 1 and b.status = 1 and b.brand_id = 1') count = 0 for x in house: print(x[0]) params = { "deleteStatus": 2, "materialId": x[0], "materialType": 1, "user": "batch" } response = requests.post(url, json=params, headers=headers_1) print(response) time.sleep(1) count += 1 if count == 1: break