Files
SnarfCode/scripts/create_argo_token.py

14 lines
506 B
Python

import requests
import json
import urllib3
urllib3.disable_warnings()
url = "https://argo.snarfnet.net/api/v1/session"
r = requests.post(url, json={"username": "admin", "password": "BbfHh3B-j6aHg3A-"}, verify=False)
admin_tok = r.json().get('token')
headers = {"Authorization": f"Bearer {admin_tok}"}
tok_url = "https://argo.snarfnet.net/api/v1/account/homepage/token"
r_tok = requests.post(tok_url, headers=headers, json={"expiresIn": 0}, verify=False)
print("ArgoCD Token:", r_tok.json().get('token'))