Compare commits
2
Commits
e56910d7e9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eef8fe95bd | ||
|
|
f5a45bf87c |
@@ -17,7 +17,10 @@ lanyard_link = "https://api.lanyard.rest/v1/users/1558056824387805300"
|
||||
CACHE_TTL = 1.0
|
||||
_cache = {"data": None, "time": 0.0}
|
||||
_lock = threading.Lock()
|
||||
|
||||
WHITELIST = [
|
||||
1558056824387805300,
|
||||
1179777658675007520,
|
||||
] #harcode final boss
|
||||
|
||||
|
||||
def get_lanyard():
|
||||
@@ -33,7 +36,7 @@ def get_lanyard():
|
||||
_cache["time"] = time.monotonic()
|
||||
except requests.RequestException:
|
||||
if _cache["data"] is None:
|
||||
raise fastapi.HTTPException(status_code=502, detail="Lanyard indisponible")
|
||||
raise fastapi.HTTPException(status_code=502, detail="Lanyard not available") #I wrote this in French, lol
|
||||
return _cache["data"]
|
||||
|
||||
|
||||
@@ -43,7 +46,9 @@ def read_root():
|
||||
@app.get("/discord")
|
||||
def read_lanyard():
|
||||
return get_lanyard()
|
||||
|
||||
@app.get("/whitelist")
|
||||
def read_whitelist():
|
||||
return WHITELIST
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
Reference in new issue
Block a user