find_us.py 964 B

12345678910111213141516171819202122232425262728293031
  1. import requests
  2. import urllib3
  3. import os
  4. urllib3.disable_warnings()
  5. TAIGA_USER = os.environ.get('TAIGA_USER', 'FrancoisLange')
  6. TAIGA_PASS = os.environ.get('TAIGA_PASS', 'your_db_password_here')
  7. base_url = 'https://192.168.130.161/taiga/api/v1'
  8. project_id = 21
  9. def main():
  10. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': TAIGA_USER, 'password': TAIGA_PASS}, verify=False)
  11. if auth_resp.status_code != 200:
  12. print("Auth failed!")
  13. return
  14. auth = auth_resp.json()
  15. headers = {
  16. 'Authorization': f'Bearer {auth["auth_token"]}',
  17. 'Content-Type': 'application/json',
  18. 'x-disable-pagination': 'true'
  19. }
  20. us = requests.get(f'{base_url}/userstories?project={project_id}', headers=headers, verify=False).json()
  21. print("User Stories:")
  22. for u in us:
  23. print(f" - [{u['ref']}] (ID: {u['id']}): {u['subject']}")
  24. if __name__ == '__main__':
  25. main()