python相同参数—不同链接循环请求

# -*- coding: utf-8 -*-
import os
import time
import requests
proxies = {'http': 'http://localhost:8888', 'https': 'http://localhost:8888'}
file_path = os.path.normpath(os.path.join(os.path.dirname(os.path.dirname(__file__)),"sms-template"))






def api_click():
"""
菜单点击-
存在多个链接,循环请求 for循环
:return:
"""

file1 = open(file_path + "/show.txt", "rb")
s = file1.readlines()
for i in range(len(s)):
url = s[i].strip("\r\n")
data = [{"headers": {"evtTime": int(time.time() * 1000), "dataType": "sms-click"},
"body":"""2_44A168DE4E15477EBB97A2793C373A02e34305d,"""}]
requests.post(url=url, json=data,proxies=proxies,verify=False)


if __name__ == '__main__':
api_click()

猜你喜欢

转载自www.cnblogs.com/testling/p/12197028.html