bundlewrap/bundles/matrix-synapse/files/synapse-reset-federation-timeout

30 lines
637 B
Text
Raw Permalink Normal View History

#!/usr/bin/env python3
from os import environ
from sys import argv, exit
from requests import post
SYNAPSE_HOST = "http://[::1]:20080/"
if "MATRIX_AUTH_TOKEN" in environ:
SYNAPSE_AUTH_TOKEN = environ["MATRIX_AUTH_TOKEN"]
else:
print("Usage: MATRIX_AUTH_TOKEN='your_token_here' {}".format(argv[0]))
exit(255)
if len(argv) != 2:
print(f"Usage: {argv[0]} <domain>")
exit(1)
r = post(
SYNAPSE_HOST
+ "_synapse/admin/v1/federation/destinations/{}/reset_connection".format(argv[1]),
headers={
"Authorization": "Bearer {}".format(SYNAPSE_AUTH_TOKEN),
},
)
r.raise_for_status()
print(r.json())