Search code examples
pythonpython-3.xpython-requestsuuid

Python-3 Minecraft UUID to Username using the Requests library


I am wondering if it is possible to take a minecraft UUID and convert it into the users current username. I know how to get all of there previous usernames, but I dont know how to single out the newest one, I am able to do this with the mojang API.

import requests
data = requests.get("https://api.mojang.com/user/profiles/UUID/names")
print(data.content)

Solution

  • SOLUTION

    I figured it out, I did the following.

    data = requests.get("https://sessionserver.mojang.com/session/minecraft/profile/uuid").json()
    print(data["name"])
    

    NOTE: The UUID must be given with out dashes ("-")