From 801231a868644f52aa319478241af5c5b20a4f5f Mon Sep 17 00:00:00 2001 From: alemidev Date: Thu, 21 Apr 2022 01:14:50 +0200 Subject: [PATCH] add simple tokenmaker example --- examples/tokenmaker.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 examples/tokenmaker.py diff --git a/examples/tokenmaker.py b/examples/tokenmaker.py new file mode 100755 index 0000000..7e6afc6 --- /dev/null +++ b/examples/tokenmaker.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +if __name__ == "__main__": + import json + import asyncio + + from getpass import getpass + + from aiocraft.mc.auth.mojang import MojangAuthenticator + + username = input("username > ") + password = getpass("password > ") + + async def main(usr, pwd): + tok = MojangAuthenticator(username=usr, password=pwd) + await tok.login() + return tok + + t = asyncio.run(main(username, password)) + + print(json.dumps(t.serialize()))