diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/database.py | 5 | ||||
-rw-r--r-- | server/lib/uuid.py | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/server/lib/database.py b/server/lib/database.py new file mode 100644 index 0000000..d4e47e6 --- /dev/null +++ b/server/lib/database.py @@ -0,0 +1,5 @@ +import sqlite3 + +def connect(): + connection = sqlite3.connect('../data/imok.db') + return connection.cursor() diff --git a/server/lib/uuid.py b/server/lib/uuid.py new file mode 100644 index 0000000..9558f21 --- /dev/null +++ b/server/lib/uuid.py @@ -0,0 +1,9 @@ +from uuid import UUID + +def validate(uuid_to_test, version=4): + try: + uuid_obj = UUID(uuid_to_test, version=version) + except: + return False + + return str(uuid_obj) == uuid_to_test |