Reorganize files

This commit is contained in:
Corder Guy 2018-04-10 14:26:40 -05:00
parent f7a9b9b7b8
commit 958cda62b7
5 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python3
"""Handle API requests to the database
something
"""
import json
import sqlite3
@ -9,14 +12,14 @@ DATABASE = '/usr/local/www/mocha-server/mocha.db'
def fetch(user_id):
conn = sqlite3.connect(DATABASE)
conn.row_factory = sqlite3.Row
c = conn.cursor()
cursor = conn.cursor()
if user_id != '*':
c.execute("SELECT * FROM users WHERE user_id=?", user_id)
cursor.execute("SELECT * FROM users WHERE user_id=?", user_id)
else:
c.execute("SELECT * FROM users")
cursor.execute("SELECT * FROM users")
output = c.fetchall()
output = cursor.fetchall()
output = json.dumps([dict(row) for row in output])
conn.close()

View file

@ -1 +0,0 @@
-r base.txt

View file

@ -1 +0,0 @@
-r base.txt

View file

@ -1 +0,0 @@
-r base.txt