inspect_taiga_stories.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import requests
  2. import urllib3
  3. import os
  4. import sys
  5. urllib3.disable_warnings()
  6. sys.stdout.reconfigure(encoding='utf-8')
  7. TAIGA_USER = os.environ.get('TAIGA_USER', 'FrancoisLange')
  8. TAIGA_PASS = os.environ.get('TAIGA_PASS', 'your_db_password_here')
  9. base_url = 'https://192.168.130.161/taiga/api/v1'
  10. def main():
  11. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': TAIGA_USER, 'password': TAIGA_PASS}, verify=False)
  12. if auth_resp.status_code != 200:
  13. print("Auth failed!")
  14. return
  15. auth = auth_resp.json()
  16. headers = {
  17. 'Authorization': f'Bearer {auth["auth_token"]}',
  18. 'Content-Type': 'application/json',
  19. 'x-disable-pagination': 'true'
  20. }
  21. project_id = 21
  22. # Fetch all user stories
  23. stories = requests.get(f'{base_url}/userstories?project={project_id}', headers=headers, verify=False).json()
  24. print(f"Total current user stories: {len(stories)}")
  25. for s in stories:
  26. print(f"ID: {s['id']}, Ref: {s['ref']}, Subject: '{s['subject']}', Status: {s['status']}")
  27. if __name__ == '__main__':
  28. main()