Initial commit.
This commit is contained in:
commit
95eadbb475
60
.gitignore
vendored
Normal file
60
.gitignore
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# Created by https://www.gitignore.io
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
14
test.py
Normal file
14
test.py
Normal file
@ -0,0 +1,14 @@
|
||||
from username_to_uuid import UsernameToUUID
|
||||
import sys
|
||||
|
||||
|
||||
print("Please enter a username: ")
|
||||
username = sys.stdin.readline().rstrip()
|
||||
|
||||
converter = UsernameToUUID(username)
|
||||
uuid = converter.get_uuid()
|
||||
|
||||
if (uuid is not ""):
|
||||
print("That player's UUID is: " + uuid)
|
||||
else:
|
||||
print("That player was not found.")
|
25
username_to_uuid.py
Normal file
25
username_to_uuid.py
Normal file
@ -0,0 +1,25 @@
|
||||
""" Username to UUID
|
||||
Converts a Minecraft username to it's UUID equivalent.
|
||||
|
||||
Parses http://www.lb-stuff.com/Minecraft-Name-History output to retrieve the UUID
|
||||
of an old name that's no longer in use.
|
||||
"""
|
||||
import http.client
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
class UsernameToUUID:
|
||||
def __init__(self, username):
|
||||
self.username = username
|
||||
|
||||
def get_uuid(self):
|
||||
"""
|
||||
Get the UUID of the player.
|
||||
"""
|
||||
httpConn = http.client.HTTPConnection("www.lb-stuff.com");
|
||||
httpConn.request("GET", "/Minecraft-Name-History?user=" + self.username);
|
||||
response = httpConn.getresponse().read()
|
||||
soup = BeautifulSoup(response)
|
||||
|
||||
return soup.body.findAll('p')[1].findAll('code')[1].text
|
Loading…
Reference in New Issue
Block a user