1234567891011121314151617181920212223242526272829 |
- import requests
- host = "https://aimp.aimpdev.k5.bigtree.tech"
- username = "lzq"
- password = "Aa123456"
- def get_token():
- headers = {
- 'accept': 'application/json, text/plain, */*',
- 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
- }
- # print(f"host: {host}, username: {username}, password: {password}") # 在一行中打印host、username和password
- json_data = {
- 'username': username,
- 'password': password,
- 'token': True,
- }
- response = requests.post(host + '/api/aimp-auth-web/auth/login', headers=headers, json=json_data)
- # print(response)
- return response.json()['token']
- # 获取计算机资源
- url = host + "/api/aimp-manager/k8s/getResources"
- data = {}
- print(requests.get(url, headers={"Access-Token": get_token()}, params=data).json())
|