Update mass_unban.py
This commit is contained in:
parent
e15aef6b6b
commit
6728419b17
@ -9,14 +9,16 @@ AUTH_TOKEN = 'syt_tokentokentoken'
|
|||||||
|
|
||||||
|
|
||||||
# unban query url
|
# 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):
|
def mass_unban(matching_keys):
|
||||||
for i in matching_keys:
|
for i in matching_keys:
|
||||||
print("Unbanning id " + i + " ...")
|
print("Unbanning id " + i + " ...")
|
||||||
headers = { "Authorization": f"Bearer {AUTH_TOKEN}" }
|
headers = { "Authorization": f"Bearer {AUTH_TOKEN}" }
|
||||||
# unban the given id
|
# 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
|
# check if the request was successful
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
print("Id unbanned successfully.\n")
|
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): ")
|
keyword = input("Please enter keyword for search (for example the domain): ")
|
||||||
print("")
|
print("")
|
||||||
headers = { "Authorization": f"Bearer {AUTH_TOKEN}" }
|
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
|
# check if the request was successful
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
Loading…
Reference in New Issue
Block a user