http_test.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import requests
  2. from mysql_db import MysqlDB
  3. headers_1 = {'content-type': "application/json", 'Authorization': 'APP appid = 4abf1a,token = 9480295ab2e2eddb8',
  4. 'dsNo': 'source1'}
  5. headers_2 = {'content-type': "application/json",
  6. 'Authorization': 'APP appid = 4abf1a,token = 9480295ab2e2eddb8',
  7. 'dsNo': 'source2',
  8. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, '
  9. 'like Gecko) Chrome/86.0.4240.111 Safari/537.36',
  10. 'Host': '101.132.43.32:5308',
  11. 'POST': '/news/queryNewsByPage HTTP/1.1',
  12. 'Connection': 'keep-alive',
  13. 'Accept': 'application/json;charset=UTF-8'
  14. }
  15. if __name__ == '__main__':
  16. import time
  17. mysql = MysqlDB('marketing_db')
  18. url = "https://api-uat3.elaber.cn/elab-marketing-content/materialLabel/markingForMaterial"
  19. 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')
  20. count = 0
  21. for x in house:
  22. print(x[0])
  23. params = {
  24. "deleteStatus": 2,
  25. "materialId": x[0],
  26. "materialType": 1,
  27. "user": "batch"
  28. }
  29. response = requests.post(url, json=params, headers=headers_1)
  30. print(response)
  31. time.sleep(1)
  32. count += 1
  33. if count == 1:
  34. break