check_taiga_name.py 968 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. def main():
  9. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': TAIGA_USER, 'password': TAIGA_PASS}, verify=False)
  10. if auth_resp.status_code != 200:
  11. print("Auth failed!")
  12. return
  13. auth = auth_resp.json()
  14. headers = {
  15. 'Authorization': f'Bearer {auth["auth_token"]}',
  16. 'Content-Type': 'application/json'
  17. }
  18. project_id = 21
  19. p = requests.get(f'{base_url}/projects/{project_id}', headers=headers, verify=False).json()
  20. print("Project ID:", p['id'])
  21. print("Project Name:", p['name'])
  22. print("Project Slug:", p['slug'])
  23. print("Project Description:", p.get('description'))
  24. if __name__ == '__main__':
  25. main()