import requests
import json
import pandas as pd
import numpy as np
import xlrd
import sys

if len(sys.argv) < 2:

sys.exit(0)

data = pd.read_excel(sys.argv[1])
train_data = np.array(data) # np.ndarray()
excel_list = train_data.tolist() # list
df=pd.DataFrame()
for i in excel_list:

print("正在查询", i[0])
payload = {"projectId": i[0]}
r = requests.get("http://XXXXXX", params=payload,stream=True)
res = r.json()
res1=res['data']
res2=res1['data']
df1 = pd.DataFrame(res2)
df=pd.concat([df,df1])

df.to_excel('result.xlsx', index=False, )
print('数据保存成功!')

标签: none

添加新评论