feat: add /user command (#5)
All checks were successful
Build / Upload to production (push) Successful in 1m43s
All checks were successful
Build / Upload to production (push) Successful in 1m43s
Reviewed-on: #5 Co-authored-by: mctaylors <cantsendmails@mctaylors.ru> Co-committed-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
6ccf2ace4a
commit
86e9c04e1e
3 changed files with 271 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
import requests
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Optional
|
||||
from config import app
|
||||
|
||||
|
||||
|
@ -57,8 +57,12 @@ def format_status(data) -> str:
|
|||
return " ".join(status)
|
||||
|
||||
|
||||
def get_json(pathname: str) -> Any | None:
|
||||
r = requests.get(f"http://{app.host}/{pathname}.json")
|
||||
def get_json(pathname: str, query: Optional[list] = None) -> Any | None:
|
||||
url = [f"http://{app.host}/{pathname}.json"]
|
||||
if query is not None:
|
||||
url.append("?")
|
||||
url.append("&".join(query))
|
||||
r = requests.get("".join(url))
|
||||
|
||||
if r.status_code != 200:
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue