Mojang
A wrapper for the Mojang API and Minecraft website
Install / Use
/learn @summer/MojangREADME
Mojang is a Python package for accessing Mojang's services. This library can be used to convert UUIDs, get a profile's information, change your Minecraft username or skin, and much more.
There are 2 components to this package, which are imported in different ways:
- Public API - Used to parse information about Minecraft profiles and more. Authentication is not required.
- Client API - Used to login to a Mojang account and access it.
At the moment, the Client API only supports authenticating to a Minecraft account via Microsoft's authentication scheme, so your Minecraft account must already be migrated. Alternatively, you may authenticate to a Mojang account directly with a Bearer token.
Installation
Python 3.7 or higher is required.
The easiest way to install the library is using pip. Just run the following console command:
python -m pip install mojang
Public API Quickstart
from mojang import API
# Create a Public API instance
api = API()
uuid = api.get_uuid("Notch")
if not uuid:
print("Notch is not a taken username.")
else:
print(f"Notch's UUID is {uuid}")
profile = api.get_profile(uuid)
print(f"Notch's skin URL is {profile.skin_url}")
print(f"Notch's skin variant is {profile.skin_variant}")
print(f"Notch's cape URL is {profile.cape_url}")
Client API Quickstart
To log into a Mojang account, the account must already be migrated to Microsoft. This means that you will be using your Microsoft credentials to login.
from mojang import Client
client = Client("YOUR_MICROSOFT_EMAIL", "YOUR_PASSWORD")
# Get the account's profile information
profile = client.get_profile()
print(profile.id)
print(profile.name)
for skin in profile.skins:
print(skin.id)
print(skin.enabled)
print(skin.url)
print(skin.variant)
Alternatively, supply a Bearer token and skip the Microsoft authentication process.
client = Client(bearer_token="MOJANG_BEARER_TOKEN_HERE")
If authentication fails, such as due to an incorrect email or password, a LoginFailure exception will occur.
Related Skills
gh-issues
343.1kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
343.1kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
tmux
343.1kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
