tmp3.py 841 B

1234567891011121314151617181920212223242526272829
  1. import requests
  2. host = "https://aimp.aimpdev.k5.bigtree.tech"
  3. username = "lzq"
  4. password = "Aa123456"
  5. def get_token():
  6. headers = {
  7. 'accept': 'application/json, text/plain, */*',
  8. 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
  9. }
  10. # print(f"host: {host}, username: {username}, password: {password}") # 在一行中打印host、username和password
  11. json_data = {
  12. 'username': username,
  13. 'password': password,
  14. 'token': True,
  15. }
  16. response = requests.post(host + '/api/aimp-auth-web/auth/login', headers=headers, json=json_data)
  17. # print(response)
  18. return response.json()['token']
  19. # 获取计算机资源
  20. url = host + "/api/aimp-manager/k8s/getResources"
  21. data = {}
  22. print(requests.get(url, headers={"Access-Token": get_token()}, params=data).json())