Files
Uni-Lab-OS/unilabos/devices/workstation/bioyond_cell/benyao_test.py
h840473807 079ec9d1b4 workstation_by_hhm
宜宾扣电工站与奔曜配液工站,更新截止10月20日
2025-10-20 15:36:53 +08:00

49 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import requests
import json
from datetime import datetime
def test_benyao_api():
# 配置信息
ip_addr = "192.168.1.200"
port = 44386
#url = f"http://{ip_addr}:{port}/api/lims/scheduler/scheduler-status"
#url = f"http://{ip_addr}:{port}/api/lims/order/order-list-status"
url = f"http://{ip_addr}:{port}/api/lims/storage/stock-material"
apiKey = "8A819E5C" # 请替换为实际apiKey
# 构造请求体
request_data = {
"apiKey": apiKey,
"requestTime": datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ"), # 示例2025-08-15T10:00:00.000Z
"data": {
"typeMode": 1,
"includeDetail": True
}
}
#request_data = {
# "apiKey": apiKey,
# "requestTime": datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ"), # 示例2025-08-15T10:00:00.000Z
# "data":
#}
print(request_data)
# 发送POST请求
try:
response = requests.post(url, json=request_data, timeout=10)
response.raise_for_status() # 检查HTTP状态码
# 解析响应
result = response.json()
print("响应状态码:", response.status_code)
print("响应内容:")
print(json.dumps(result, indent=2, ensure_ascii=False))
except requests.exceptions.RequestException as e:
print("请求失败:", e)
except json.JSONDecodeError as e:
print("JSON解析失败:", e)
if __name__ == "__main__":
test_benyao_api()