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.
Metadata
Release files for mojang 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mojang-1.1.0.tar.gz | 12.9 kB | Without provenance | Details for mojang-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mojang-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for mojang-1.1.0-py3-none-any.whl |
Total release size: 26.6 kB
Release files / mojang-1.1.0.tar.gz
| Download URL | mojang-1.1.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08c2d6156e8c1d60afd3c0cef60a9198b4b21bdd8a3d2b15a0b309fb122fbbac
|
|
BLAKE2b-256 checksum How to use checksums |
d6a15043c107234ea09cde5f575a7cb8b267ab63a0bb266d828aa9468839378b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / mojang-1.1.0-py3-none-any.whl
| Download URL | mojang-1.1.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58dcd826ebbb49aa18d97bff9c2cf4ed4bcbba4c64bfd6630ece1ce33359d864
|
|
BLAKE2b-256 checksum How to use checksums |
d3bea3af5b5cd9e827c68cd2a4997cd65587052c7b3ed76ba682c48434edd502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for mojang 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.