#!/usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# encodeing:utf-8
import requests
import os
import json
fileDir = "/Users/payegis/Downloads/IPA测试集/iPA自动化测试集/95" # 输入文件夹路径
# 利用os.listdir()、os.walk()获取文件夹和文件名
def GetFileName(dir):
listName = []
for dir in os.listdir(fileDir):
listName.append(os.path.splitext(dir)[0])
return listName
def GetPathName(dir):
listPath = []
for dir in os.listdir(fileDir):
listPath.append(os.path.join(fileDir, dir))
return listPath
def iossacnTest():
url = 'http://localhost:8080/beidou/local'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
name = GetFileName(fileDir)
path = GetPathName(fileDir)
for i in range(len(name)):
data = {
"fileId": name[i],
"taskId": name[i],
"apkPath": path[i],
"EStrategy": "SmartExecution2",
"SStrategy": "-0"
}
resp = requests.post(url, data, headers)
print resp.text
if __name__ == '__main__':
iossacnTest()
具体实现,将list中的内容用标记符,分别传入到dict中
如下:for(int i = 0;i<list.length;i++){ int a = listA[i] intb = listB[i] }
网友评论