Skip to main content

PyPI version PyPI - Python Version

Read the Docs MIT License PyPI - Monthly Downloads

Documentation

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 model is {profile.skin_model}")
    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 be thrown.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mojang-0.2.5.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mojang-0.2.5-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file mojang-0.2.5.tar.gz.

File metadata

  • Download URL: mojang-0.2.5.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for mojang-0.2.5.tar.gz
Algorithm Hash digest
SHA256 15a1ec7e194ab6f15ac941cf0eb4be4dd7ac730e17ccbbad414db60542deb17d
MD5 ab02eaec062d62ba6007568db4df80c5
BLAKE2b-256 55c66e992f07be54f36342ef6201c72d398e3e6b07574667caef5c3b65e4d768

See more details on using hashes here.

File details

Details for the file mojang-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: mojang-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for mojang-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1df95f5ca63f3d24eefc297e1b9cb3d3e6f312f90132b795813acb5cca7b7364
MD5 eb0079c96ccb3f0ffe13baf02ad2f314
BLAKE2b-256 664c82d00a1ffcb0ed1bd5630a04dd1c2eb64faf894d0b5894ba3d41bccdbb9a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

0.2.6

2 files

This release

0.2.5 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.9

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page