mirror of
https://github.com/bsedin/matrix-webhook.git
synced 2026-04-09 11:25:40 +00:00
allow "key" to be passed as a parameter
This was initially designed and implemented in #4 Co-authored-by: Sven Seeberg <mail@sven-seeberg.de>
This commit is contained in:
@@ -25,12 +25,17 @@ parser.add_argument(
|
||||
)
|
||||
|
||||
|
||||
def bot_req(req=None, key=None, room_id=None):
|
||||
def bot_req(req=None, key=None, room_id=None, key_as_param=False):
|
||||
"""Bot requests boilerplate."""
|
||||
params = {}
|
||||
|
||||
if key is not None:
|
||||
req["key"] = key
|
||||
if key_as_param:
|
||||
params["key"] = key
|
||||
else:
|
||||
req["key"] = key
|
||||
url = BOT_URL if room_id is None else f"{BOT_URL}/{room_id}"
|
||||
return httpx.post(url, json=req).json()
|
||||
return httpx.post(url, params=params, json=req).json()
|
||||
|
||||
|
||||
def wait_available(url: str, key: str, timeout: int = 10) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user