1
0

test_us203.py 885 B

123456789101112131415161718192021222324
  1. import requests
  2. import urllib3
  3. import os
  4. urllib3.disable_warnings()
  5. TAIGA_USER = 'FrancoisLange'
  6. TAIGA_PASS = 'your_db_password_here'
  7. base_url = 'https://192.168.130.161/taiga/api/v1'
  8. project_id = 21
  9. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': TAIGA_USER, 'password': TAIGA_PASS}, verify=False)
  10. auth = auth_resp.json()
  11. headers = {'Authorization': f'Bearer {auth["auth_token"]}', 'Content-Type': 'application/json', 'x-disable-pagination': 'true'}
  12. user_stories = requests.get(f'{base_url}/userstories?project={project_id}', headers=headers, verify=False).json()
  13. us = next((u for u in user_stories if u['ref'] == 203 or 'US-203' in u['subject'] or '203' in u['subject']), None)
  14. if us:
  15. print("US ID:", us['id'])
  16. print("Subject:", us['subject'])
  17. print("Description:\n", us.get('description', ''))
  18. else:
  19. print("US-203 not found!")