You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
494 B
21 lines
494 B
|
3 months ago
|
import requests
|
||
|
|
import json
|
||
|
|
|
||
|
|
# 测试连接到天勤服务器
|
||
|
|
def test_connect():
|
||
|
|
url = "http://127.0.0.1:8001/api/connect"
|
||
|
|
data = {
|
||
|
|
"username": "windsdreamer",
|
||
|
|
"password": "1qazse42W3"
|
||
|
|
}
|
||
|
|
|
||
|
|
try:
|
||
|
|
response = requests.post(url, json=data, timeout=10)
|
||
|
|
print(f"Status code: {response.status_code}")
|
||
|
|
print(f"Response: {response.json()}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Error: {e}")
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
test_connect()
|