#
[![PyPI version](https://badge.fury.io/py/mojang.svg)](https://badge.fury.io/py/mojang)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mojang?style=flat-square)
[![Read the Docs](https://img.shields.io/readthedocs/mojang?style=flat-square)](https://mojang.readthedocs.io/en/latest/)
[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/summer/mojang/blob/master/LICENSE/)
[![PyPI - Monthly Downloads](https://img.shields.io/pypi/dm/mojang?style=flat-square)](https://pypistats.org/packages/mojang)
[**Documentation**](https://mojang.readthedocs.io/en/latest/)
```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**
```py
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}")
```
- [Full Public API documentation](https://mojang.readthedocs.io/en/latest/api/)
## **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.
```py
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.
```py
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.
- [Full Client API documentation](https://mojang.readthedocs.io/en/latest/client/)
Raw data
{
"_id": null,
"home_page": "https://github.com/summer/mojang",
"name": "mojang",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "mojang,minecraft,api,mojang api,minecraft api",
"author": "summer",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/d6/a1/5043c107234ea09cde5f575a7cb8b267ab63a0bb266d828aa9468839378b/mojang-1.1.0.tar.gz",
"platform": null,
"description": "#\r\n[![PyPI version](https://badge.fury.io/py/mojang.svg)](https://badge.fury.io/py/mojang)\r\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mojang?style=flat-square)\r\n\r\n[![Read the Docs](https://img.shields.io/readthedocs/mojang?style=flat-square)](https://mojang.readthedocs.io/en/latest/)\r\n[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/summer/mojang/blob/master/LICENSE/)\r\n[![PyPI - Monthly Downloads](https://img.shields.io/pypi/dm/mojang?style=flat-square)](https://pypistats.org/packages/mojang)\r\n\r\n[**Documentation**](https://mojang.readthedocs.io/en/latest/)\r\n\r\n```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. \r\n\r\nThere are 2 components to this package, which are imported in different ways:\r\n\r\n- **Public API** - Used to parse information about Minecraft profiles and more. Authentication is not required.\r\n- **Client API** - Used to login to a Mojang account and access it.\r\n\r\nAt 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.\r\n\r\n\r\n## Installation\r\n**Python 3.7 or higher is required.**\r\n\r\nThe easiest way to install the library is using `pip`. Just run the following console command:\r\n\r\n```\r\npython -m pip install mojang\r\n```\r\n\r\n\r\n## **Public API Quickstart**\r\n\r\n```py\r\nfrom mojang import API\r\n\r\n# Create a Public API instance\r\napi = API()\r\n\r\nuuid = api.get_uuid(\"Notch\")\r\n\r\nif not uuid:\r\n print(\"Notch is not a taken username.\")\r\nelse:\r\n print(f\"Notch's UUID is {uuid}\")\r\n\r\n profile = api.get_profile(uuid)\r\n print(f\"Notch's skin URL is {profile.skin_url}\")\r\n print(f\"Notch's skin variant is {profile.skin_variant}\")\r\n print(f\"Notch's cape URL is {profile.cape_url}\")\r\n```\r\n\r\n- [Full Public API documentation](https://mojang.readthedocs.io/en/latest/api/)\r\n\r\n\r\n## **Client API Quickstart**\r\nTo log into a Mojang account, the account must already be migrated to Microsoft. \r\nThis means that you will be using your Microsoft credentials to login.\r\n\r\n```py\r\nfrom mojang import Client\r\n\r\nclient = Client(\"YOUR_MICROSOFT_EMAIL\", \"YOUR_PASSWORD\")\r\n\r\n# Get the account's profile information\r\nprofile = client.get_profile()\r\n\r\nprint(profile.id)\r\nprint(profile.name)\r\n\r\nfor skin in profile.skins:\r\n print(skin.id)\r\n print(skin.enabled)\r\n print(skin.url)\r\n print(skin.variant)\r\n```\r\n\r\nAlternatively, supply a Bearer token and skip the Microsoft authentication process.\r\n```py\r\nclient = Client(bearer_token=\"MOJANG_BEARER_TOKEN_HERE\")\r\n```\r\nIf authentication fails, such as due to an incorrect email or password, a `LoginFailure` exception will occur.\r\n\r\n- [Full Client API documentation](https://mojang.readthedocs.io/en/latest/client/)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python wrapper for the Mojang API and Minecraft website",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/summer/mojang"
},
"split_keywords": [
"mojang",
"minecraft",
"api",
"mojang api",
"minecraft api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d3bea3af5b5cd9e827c68cd2a4997cd65587052c7b3ed76ba682c48434edd502",
"md5": "c8dd7bd2196eba4f4e2c2f895b809826",
"sha256": "58dcd826ebbb49aa18d97bff9c2cf4ed4bcbba4c64bfd6630ece1ce33359d864"
},
"downloads": -1,
"filename": "mojang-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8dd7bd2196eba4f4e2c2f895b809826",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 13677,
"upload_time": "2023-03-17T23:59:21",
"upload_time_iso_8601": "2023-03-17T23:59:21.380824Z",
"url": "https://files.pythonhosted.org/packages/d3/be/a3af5b5cd9e827c68cd2a4997cd65587052c7b3ed76ba682c48434edd502/mojang-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d6a15043c107234ea09cde5f575a7cb8b267ab63a0bb266d828aa9468839378b",
"md5": "688432e5472d839fc942099628bd96e1",
"sha256": "08c2d6156e8c1d60afd3c0cef60a9198b4b21bdd8a3d2b15a0b309fb122fbbac"
},
"downloads": -1,
"filename": "mojang-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "688432e5472d839fc942099628bd96e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12899,
"upload_time": "2023-03-17T23:59:23",
"upload_time_iso_8601": "2023-03-17T23:59:23.252561Z",
"url": "https://files.pythonhosted.org/packages/d6/a1/5043c107234ea09cde5f575a7cb8b267ab63a0bb266d828aa9468839378b/mojang-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-17 23:59:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "summer",
"github_project": "mojang",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mojang"
}