diff --git a/README.md b/README.md index 0246ec5..6ac9599 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,45 @@ if is_valid_mojang_uuid('a2080281c2784181b961d99ed2f3347c'): print('Valid') ``` +## Documentation +### Module `mcuuid.api` +#### Class `GetPlayerData(indentifier, timestamp=None)` +##### Parameters +- `identifier`: string - a Minecraft username or Mojang UUID +- `timestamp`: int - a unix timestamp + +##### Returns +`player` object + +#### Object `player` +##### Value `player.uuid` +Mojang UUID + +##### Value `player.username` +Minecraft username + +### Module `mcuuid.tools` +#### Function `is_valid_minecraft_username(username)` +##### Parameters +- `username`: string - a Minecraft username + +##### Returns +`True` or `False` + +#### Function `is_valid_mojang_uuid(uuid)` +##### Parameters +- `uuid`: string - a Mojang UUID + +##### Returns +`True` or `False` + +#### Function `cleanup_uuid(uuid)` +##### Parameters +- `uuid`: string - a Mojang UUID + +##### Returns +`uuid` as string, lowered. Without dashes + ## Test file Usage ``` diff --git a/mcuuid/api.py b/mcuuid/api.py index 80f4b09..bee5b02 100644 --- a/mcuuid/api.py +++ b/mcuuid/api.py @@ -7,8 +7,8 @@ Uses the official Mojang API to fetch player data. ### Import necessary modules import http.client import json -from tools import is_valid_minecraft_username -from tools import is_valid_mojang_uuid +from mcuuid.tools import is_valid_minecraft_username +from mcuuid.tools import is_valid_mojang_uuid ### Main class class GetPlayerData: diff --git a/mcuuid/tools.py b/mcuuid/tools.py index ec12f6b..ba06b0f 100644 --- a/mcuuid/tools.py +++ b/mcuuid/tools.py @@ -29,3 +29,8 @@ def is_valid_mojang_uuid(uuid): return False return True + +def cleanup_uuid(uuid): + uuid = uuid.lower() + uuid = uuid.replace('-', '') + return uuid diff --git a/setup.py b/setup.py index 64ff11d..2c2a583 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="mcuuid", - version="0.2", + version="0.3", author="Clemens Riese", author_email="hallo@clerie.de", description="Getting Minecraft Player Information from Mojang API.", @@ -15,7 +15,6 @@ setuptools.setup( packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 2", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], diff --git a/test.py b/test.py index 58e771f..4543c9e 100644 --- a/test.py +++ b/test.py @@ -20,7 +20,7 @@ if len(sys.argv) > 1: # Else, ask for a identifier by userinput else: print("Please enter a username or UUID: ") - identifier = raw_input() + identifier = input() ### Is the identifier a valid value? if is_valid_minecraft_username(identifier) or is_valid_mojang_uuid(identifier):