An async Python wrapper for the Mojang API.
Project description
Async-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 is one component to this package:
- Public API - Used to parse information about Minecraft profiles and more. Authentication is not required.
Installation
Python 3.7 or higher is required.
The easiest way to install the library is using pip
. Just run the following console command:
pip install async-mojang
Public API Quickstart
import asyncio
from async_mojang import API
async def get_uuid(username: str):
async with API() as api:
uuid = await api.get_uuid(username)
return uuid
async def get_stripped_uuid(username: str):
async with API() as api:
stripped_uuid = await api.get_stripped_uuid(username)
return stripped_uuid
async def get_username(uuid: str):
async with API() as api:
username = await api.get_username(uuid)
return username
async def get_profile(uuid: str):
async with API() as api:
profile = await api.get_profile(uuid)
return profile
async def get_blocked_servers():
async with API() as api:
blocked_servers = await api.get_blocked_servers()
return blocked_servers
async def main():
uuid = await get_uuid("FroostySnoowman")
print(uuid)
stripped_uuid = await get_stripped_uuid("FroostySnoowman")
print(stripped_uuid)
username = await get_username(uuid)
print(username)
profile = await get_profile(uuid)
print(profile)
blocked_servers = await get_blocked_servers()
print(blocked_servers)
if __name__ == "__main__":
asyncio.run(main())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
async_mojang-1.0.4.tar.gz
(6.0 kB
view details)
Built Distribution
File details
Details for the file async_mojang-1.0.4.tar.gz
.
File metadata
- Download URL: async_mojang-1.0.4.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9851b717044d8689caf65bd2216c1c1fe45c0ce2203094779376f5f6d10132ba |
|
MD5 | 5e9e9b95af0d2f7dac953c9d24c4d76b |
|
BLAKE2b-256 | 636b37a56df6a8ffcec695667e26a5d22701c1e579cb8deea118d6ec1dcc3aba |
File details
Details for the file async_mojang-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: async_mojang-1.0.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7117fe4c60f600178dffb17835df41b641c92eea2ea3eddd906daa81cc45c517 |
|
MD5 | d674f115aa7f361685e7eaab7081400b |
|
BLAKE2b-256 | dd5791462b4598889dea45573f8c8a793c22cd9f699b24a3ba11a8b30857398b |