1
0

setup_sprint13_taiga.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import requests
  2. import urllib3
  3. from datetime import datetime, timedelta
  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("Fetching Sprints...")
  10. milestones = requests.get(f'{base_url}/milestones?project={proj_id}', headers=headers, verify=False).json()
  11. sprint13 = next((m for m in milestones if m['name'] == 'Sprint 13'), None)
  12. if not sprint13:
  13. print("Sprint 13 not found, creating it...")
  14. payload = {
  15. "project": proj_id,
  16. "name": "Sprint 13",
  17. "estimated_start": datetime.now().strftime('%Y-%m-%d'),
  18. "estimated_finish": (datetime.now() + timedelta(days=7)).strftime('%Y-%m-%d')
  19. }
  20. sprint13 = requests.post(f'{base_url}/milestones', json=payload, headers=headers, verify=False).json()
  21. sprint_id = sprint13['id']
  22. print(f"Sprint 13 ID: {sprint_id}")
  23. stories = [
  24. {"subject": "Deploy Local SearXNG Web Search Tool", "description": "The AI must have a local web search tool that it will use to anonymously gather any info that it does not have in its local database."}
  25. ]
  26. for s in stories:
  27. payload = {
  28. "project": proj_id,
  29. "subject": s["subject"],
  30. "description": s["description"],
  31. "milestone": sprint_id
  32. }
  33. res = requests.post(f'{base_url}/userstories', json=payload, headers=headers, verify=False)
  34. if res.status_code == 201:
  35. us = res.json()
  36. print(f"Created US: {us['subject']}")
  37. # Create tasks
  38. tasks = ["Inject SearXNG container into docker-compose.yml", "Implement Web Search Heuristic fallback in AI Chat", "Integrate SearXNG API payload parsing with Ollama"]
  39. for t in tasks:
  40. t_payload = {
  41. "project": proj_id,
  42. "subject": t,
  43. "user_story": us['id'],
  44. "milestone": sprint_id
  45. }
  46. requests.post(f'{base_url}/tasks', json=t_payload, headers=headers, verify=False)
  47. print("Sprint 13 populated!")