From 6728419b1799bcb1e236cbedba8fde5374a9d233 Mon Sep 17 00:00:00 2001 From: cynic Date: Sun, 8 Dec 2024 13:02:34 -0600 Subject: [PATCH] Update mass_unban.py --- mass_unban.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mass_unban.py b/mass_unban.py index 85dcb5a..15ee5ac 100644 --- a/mass_unban.py +++ b/mass_unban.py @@ -9,14 +9,16 @@ AUTH_TOKEN = 'syt_tokentokentoken' # unban query url -URL = f"https://{DOMAIN}/_matrix/client/r0/rooms/{ROOM_ID}/members?membership=ban" +URL = f"https://{DOMAIN}/_matrix/client/r0/rooms/{ROOM_ID}/" def mass_unban(matching_keys): for i in matching_keys: print("Unbanning id " + i + " ...") headers = { "Authorization": f"Bearer {AUTH_TOKEN}" } # unban the given id - response_unban = requests.get(URL, headers=headers) + data = {"user_id": i} + unban_url = URL + 'unban' + response_unban = requests.post(unban_url, headers=headers, json=data) # check if the request was successful if response.status_code == 200: print("Id unbanned successfully.\n") @@ -27,7 +29,8 @@ def mass_unban(matching_keys): keyword = input("Please enter keyword for search (for example the domain): ") print("") headers = { "Authorization": f"Bearer {AUTH_TOKEN}" } -response = requests.get(URL, headers=headers) +banned_url = URL + "members?membership=ban" +response = requests.get(banned_url, headers=headers) # check if the request was successful if response.status_code == 200: