CoolFace
Apppublic

cuttell2000/Calgary_Building_Permit_Map_App

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
restart_space.py19 linesDownload Raw Back to root
1import requests2import os3 4# Your Hugging Face token (set as environment variable)5HF_TOKEN = os.getenv("HF_TOKEN")6USERNAME = "cuttell2000"  # Replace with your Hugging Face username7SPACE_NAME = "Calgary_Building_Permit_Map_App"  # Replace with your Space name (e.g., "calgary-building-permits")8 9def restart_space():10    url = f"https://huggingface.co/api/spaces/{USERNAME}/{SPACE_NAME}/restart"11    headers = {"Authorization": f"Bearer {HF_TOKEN}"}12    response = requests.post(url, headers=headers)13    if response.status_code == 200:14        print("✅ Space restarted successfully.")15    else:16        print(f"❌ Failed to restart Space: {response.status_code} - {response.text}")17 18if __name__ == "__main__":19    restart_space()