AllSpice-Install/install-scripts/test-allspice-hello-world.py

23 lines
632 B
Python

# Get_shas.py
import os
from allspice import AllSpice, Repository
# ----------------------------
# Test basic server connectivity
try:
URL = os.environ['ALLSPICE_URL']
except KeyError:
print("Invalid URL. Run this command:")
print("export ALLSPICE_URL=\"https://hub.allspice.io\"")
try:
TOKEN = os.environ['ALLSPICE_ACCESS_TOKEN']
except KeyError:
print("Token. Set environmental variables")
print(">export ALLSPICE_ACCESS_TOKEN=\"YourAccessToken\"")
allspice = AllSpice(URL, TOKEN)
print("AllSpice Version: " + allspice.get_version())
print("API-Token belongs to user: " + allspice.get_user().username)