postman调用接口post接口 https://inner-XXXXX.XXXXX.com/wXX/api/XXXXXctoryLake?user_key=XXXXXXXXXXXX,在boday的row里输入Jason格式的 {"wasStartDay":"2024-09-03"}
import requests
url = 'https://inner-XXXXX.XXXXX.com/wXX/api/XXXXXctoryLake'
data = {"wasStartDay": "2024-09-03"}
params = {"user_key": "XXXXXXXXXXXX"}
response = requests.post(url, params=params, json=data)
json_data = response.json()
# 提取数据
rows = json_data['data']['rows']
insert_statements = []
for row in rows:
userAccountNumber = row['userAccountNumber']
loginNum = row['loginNum']
lid = row['lid']
visitDay = row['visitDay']
deptFullName = row['deptFullName']
# 拼接INSERT语句
insert_statement = f"INSERT INTO your_table (userAccountNumber, loginNum, lid, visitDay, deptFullName) VALUES ('{userAccountNumber}', {loginNum}, '{lid}', '{visitDay}', '{deptFullName}');"
insert_statements.append(insert_statement)
# 打印INSERT语句
for statement in insert_statements:
print(statement)