Advertisement
heyfranks

Untitled

Nov 20th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import sqlite3
  2. from flask import jsonify
  3. from flask import Flask
  4. from flask import request
  5.  
  6. app = Flask(__name__)
  7.  
  8. @app.route("/api/<patente>/agregar")
  9. def agregar(patente):
  10.     # pantente = request.args.get["patente"]
  11.     conn = sqlite3.connect('sqlite/deteccion.db')
  12.     c = conn.cursor()
  13.     c.execute("INSERT INTO VEHICULO VALUES (null,'%s', 4567890,1)" %patente)
  14.     conn.commit()
  15.     conn.close()
  16.     return patente
  17.  
  18. @app.route("/api/<patente>/eliminar")
  19. def eliminar(patente):
  20.     # pantente = request.args.get["patente"]
  21.     conn = sqlite3.connect('sqlite/deteccion.db')
  22.     c = conn.cursor()
  23.     c.execute("UPDATE VEHICULO SET encargo_vehiculo = 0 WHERE patente_vehiculo = '%s'" %patente)
  24.     conn.commit()
  25.     conn.close()
  26.     return patente
  27.  
  28. app.run(host="127.0.0.1", port=8080, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement