get_wiki.py 630 B

123456789101112131415
  1. import requests
  2. import urllib3
  3. urllib3.disable_warnings()
  4. base_url = 'https://192.168.130.161/taiga/api/v1'
  5. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': 'FrancoisLange', 'password': 'your_db_password_here'}, verify=False)
  6. if auth_resp.status_code == 200:
  7. auth = auth_resp.json()
  8. h = {'Authorization': f'Bearer {auth["auth_token"]}'}
  9. res = requests.get(f'{base_url}/wiki?project=21', headers=h, verify=False).json()
  10. for w in res:
  11. print(f"Slug: {w['slug']}, Title: {w.get('subject') or w['slug']}")
  12. else:
  13. print("Auth failed", auth_resp.status_code, auth_resp.text)