Skip to content

Instantly share code, notes, and snippets.

@btarg
Last active May 7, 2019 10:18
Show Gist options
  • Save btarg/edc9a23768c8874c59b933d4e47a8e91 to your computer and use it in GitHub Desktop.
Save btarg/edc9a23768c8874c59b933d4e47a8e91 to your computer and use it in GitHub Desktop.
[UPDATED] Get MC UUID from username (for use with APIs like Crafatar)
import requests
import urllib.request
import json
while True:
username = input("Enter username: ")
try:
# Make requests to Mojang API and grab info
data = urllib.request.urlopen("https://api.mojang.com/users/profiles/minecraft/" + username).read()
uuid = json.loads(data)["id"]
print(uuid)
except:
print("\nAn error occurred.\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment