taiga_audit.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import requests
  2. import urllib3
  3. import json
  4. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  5. base_url = 'https://192.168.130.161/taiga/api/v1'
  6. auth = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': 'FrancoisLange', 'password': 'BTSai123'}, verify=False).json()
  7. headers = {'Authorization': f'Bearer {auth["auth_token"]}', 'Content-Type': 'application/json'}
  8. proj_id = 21
  9. print("--- TAIGA AUDIT REPORT ---")
  10. # 1. Sprints Check
  11. milestones = requests.get(f'{base_url}/milestones?project={proj_id}', headers=headers, verify=False).json()
  12. print(f"Total Sprints: {len(milestones)}")
  13. for m in milestones:
  14. us_list = m.get('user_stories', [])
  15. if not us_list:
  16. print(f"WARNING: Sprint '{m['name']}' has NO User Stories.")
  17. else:
  18. # Get tasks for sprint
  19. tasks = requests.get(f'{base_url}/tasks?project={proj_id}&milestone={m["id"]}', headers=headers, verify=False).json()
  20. if not tasks:
  21. print(f"WARNING: Sprint '{m['name']}' has User Stories but NO Tasks.")
  22. # 2. User Stories Check
  23. us_all = requests.get(f'{base_url}/userstories?project={proj_id}', headers=headers, verify=False).json()
  24. for us in us_all:
  25. tasks = requests.get(f'{base_url}/tasks?project={proj_id}&user_story={us["id"]}', headers=headers, verify=False).json()
  26. if not tasks:
  27. print(f"WARNING: User Story '{us['subject']}' (ID: {us['id']}) has NO Tasks.")
  28. # 3. Wiki Check
  29. wiki_pages = requests.get(f'{base_url}/wiki?project={proj_id}', headers=headers, verify=False).json()
  30. print("\n--- WIKI PAGES ---")
  31. for wp in wiki_pages:
  32. print(f"- {wp['slug']}")