summaryrefslogtreecommitdiffstats
path: root/kalauerbot/get_token.py
blob: 4b92f43d0c11db2a3708a71b59899793f5b89789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

import sys
import requests
import json

host = "https://ext01.citadel.team"
mail = sys.argv[1]
pwd = sys.argv[2]

def main():
    url = f"{host}/_matrix/client/r0/login"
    options = {
        "type": "m.login.password",
        "identifier": {
            "type": "m.id.thirdparty",
            "medium": "email",
            "address": mail,
        },
        "password": pwd
    }
    r = requests.post(url, json=options)
    response = r.json()
    print(json.dumps(response,indent=2))
    url=f"https://ext01.citadel.team/_matrix/client/r0/sync?access_token={response['access_token']}"
    print(f"now run\ncurl {url}")

if __name__ == "__main__":
    main()