1
0

test_taiga.py 808 B

123456789101112131415161718192021
  1. import requests
  2. import urllib3
  3. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  4. auth = requests.post(
  5. 'https://192.168.130.161/taiga/api/v1/auth',
  6. json={'type': 'normal', 'username': 'lanfr1904@outlook.com', 'password': 'BTSai123'},
  7. verify=False
  8. ).json()
  9. headers = {'Authorization': f'Bearer {auth["auth_token"]}'}
  10. proj_id = 21
  11. m_res = requests.get(f'https://192.168.130.161/taiga/api/v1/milestones?project={proj_id}', headers=headers, verify=False).json()
  12. print('Milestones:', [(m['name'], m['id']) for m in m_res])
  13. w_res = requests.get(f'https://192.168.130.161/taiga/api/v1/wiki?project={proj_id}', headers=headers, verify=False)
  14. if w_res.status_code == 200:
  15. print('Wikis:', [(w['slug'], w['id']) for w in w_res.json()])
  16. else:
  17. print('Wiki error:', w_res.text)