Exemple #1
0
def sample():
    cur = conn.cursor()
    cur.execute(
        "SELECT name, data FROM data OFFSET floor(random() * (SELECT count(*) FROM data)) LIMIT 1"
    )
    name, data = cur.fetchone()
    ret = {"data": data, "name": name}
    return Response(json.dumps(ret))
Exemple #2
0
def submit():
  data = request.form['data']
  print request.form['name']
  cur = conn.cursor()
  cur.execute("INSERT into images2 (name, data, track, email, gid) VALUES (%s, %s, %s, %s, %s)", (request.form['name'], request.form['data'], request.form['track'], request.form['email'], request.form['gid']))
  conn.commit()
  cur.close()
  return "thanks"
Exemple #3
0
def submit():
    data = request.form['data']
    print(request.form['name'])
    cur = conn.cursor()
    cur.execute(
        "INSERT into images2 (name, data, track, email, gid) VALUES (%s, %s, %s, %s, %s)",
        (request.form['name'], request.form['data'], request.form['track'],
         request.form['email'], request.form['gid']))
    conn.commit()
    cur.close()
    return "thanks"
Exemple #4
0
def suggestion(name):
    cur = conn.cursor()
    cur.execute("SELECT data FROM suggestions WHERE name = %s", (name, ))
    data = cur.fetchone()[0]
    ret = {"data": data}
    return Response(json.dumps(ret))
Exemple #5
0
def suggestion(name):
  cur = conn.cursor()
  cur.execute("SELECT data FROM suggestions WHERE name = %s", (name,))
  data = cur.fetchone()[0]
  ret = {"data": data}
  return Response(json.dumps(ret))
Exemple #6
0
def sample():
  cur = conn.cursor()
  cur.execute("SELECT name, data FROM data OFFSET floor(random() * (SELECT count(*) FROM data)) LIMIT 1")
  name, data = cur.fetchone()
  ret = {"data": data, "name": name}
  return Response(json.dumps(ret))