Fix backup url (#116)

Co-authored-by: Freddy Boulton <freddyboulton@hf-freddy.local>
This commit is contained in:
Freddy Boulton
2025-03-02 18:35:32 -05:00
committed by GitHub
parent 25c2152304
commit 146143efb7
3 changed files with 260 additions and 5 deletions

View File

@@ -592,11 +592,19 @@ class Stream(WebRTCConnectionMixin):
host = urllib.parse.urlparse(url).netloc
URL = "https://api.fastrtc.org"
r = httpx.post(
URL + "/register",
json={"url": host},
headers={"Authorization": token or get_token() or ""},
)
try:
r = httpx.post(
URL + "/register",
json={"url": host},
headers={"Authorization": token or get_token() or ""},
)
except Exception:
URL = "https://fastrtc-fastphone.hf.space"
r = httpx.post(
URL + "/register",
json={"url": host},
headers={"Authorization": token or get_token() or ""},
)
r.raise_for_status()
data = r.json()
code = f"{data['code']}"