Spaces:
Running
Running
Tu Nombre commited on
Commit ·
104855b
1
Parent(s): ba3229a
auto-restart space tras token
Browse files
main.py
CHANGED
|
@@ -684,6 +684,12 @@ async def oauth_callback(code: str, state: str):
|
|
| 684 |
content=f'{{"key":"header","value":{{"summary":"add token"}}}}\n{{"key":"file","value":{{"path":"token.json","content":"{content_b64}","encoding":"base64"}}}}\n'
|
| 685 |
)
|
| 686 |
print(f"Token upload: {r.status_code} {r.text[:200]}", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
CLIENTES[email]["youtube_conectado"] = True
|
| 688 |
guardar_clientes()
|
| 689 |
url_cliente = CLIENTES.get(email, {}).get("url", "")
|
|
|
|
| 684 |
content=f'{{"key":"header","value":{{"summary":"add token"}}}}\n{{"key":"file","value":{{"path":"token.json","content":"{content_b64}","encoding":"base64"}}}}\n'
|
| 685 |
)
|
| 686 |
print(f"Token upload: {r.status_code} {r.text[:200]}", flush=True)
|
| 687 |
+
# Reiniciar Space del cliente para que lea el token
|
| 688 |
+
r2 = await client.post(
|
| 689 |
+
f"https://huggingface.co/api/spaces/{space_repo}/restart",
|
| 690 |
+
headers={"Authorization": f"Bearer {hf_token_repo}"}
|
| 691 |
+
)
|
| 692 |
+
print(f"Restart: {r2.status_code}", flush=True)
|
| 693 |
CLIENTES[email]["youtube_conectado"] = True
|
| 694 |
guardar_clientes()
|
| 695 |
url_cliente = CLIENTES.get(email, {}).get("url", "")
|