add simple tokenmaker example

This commit is contained in:
əlemi 2022-04-21 01:14:50 +02:00
parent 022ed83187
commit 801231a868
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

20
examples/tokenmaker.py Executable file
View file

@ -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()))