diff options
author | ngharo <nick@ngha.ro> | 2017-12-13 00:19:14 -0600 |
---|---|---|
committer | ngharo <nick@ngha.ro> | 2017-12-13 00:19:14 -0600 |
commit | df3f5844ea334a83955efbab7f58861ae6ccd763 (patch) | |
tree | 3ec77c93fa1527c2212fefccc789a552898dc417 /server/lib | |
download | imOk-www-df3f5844ea334a83955efbab7f58861ae6ccd763.tar.xz imOk-www-df3f5844ea334a83955efbab7f58861ae6ccd763.zip |
Starting to build out cherrypy API
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 |