-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathlib.py
More file actions
38 lines (27 loc) · 772 Bytes
/
lib.py
File metadata and controls
38 lines (27 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
Python 3.0 library with functions to convert to and from mc uuid and player names
'''
import json, requests
BASE_URL = 'https://api.mojang.com/'
UUID_URL = BASE_URL + 'users/profiles/minecraft/'
NAME_URL = BASE_URL + '/user/profiles/'
# def getJSON(url, params):
# response = requests.get(url=url, params=params)
# return json.loads(response.text)
def hasHyphens(uuid):
return
def stripUUID(uuid):
return
def hyphenUUID(uuid):
return
def hasError(json):
return json.has_key('error')
def toUUID(name):
# TODO: JSON request to get the uuid
respone = requests.get(url=UUID_URL + name)
_json = response.json()
if not hasError(_json):
return hyphenUUID(_json['id'])
return
def fromUUIS(uuid):
pass