online_tools_2 / restart.py
admin
upl ksa
751f3b1
raw
history blame
583 Bytes
import requests
from smtp import send_email
from config import *
def restart_private_space(repo: str, cookie: str):
try:
response = requests.post(
f"{HF_DOMAIN}/api/spaces/{repo}/restart",
headers={
"User-Agent": HEADER["User-Agent"],
"cookie": cookie,
},
timeout=TIMEOUT,
)
response.raise_for_status()
except Exception as e:
send_email(f"{e}", "Restart failure", f"Failed to restart {repo}")
def restart():
restart_private_space("kakamond/ksa", COOKIE)