a guest Jan 24th, 2020 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- @app.route('/upsala', methods=['POST'])
- def update_sala():
- conn = pymysql.connect()
- cursor = conn.cursor()
- _json = request.json
- _id_salas = _json['id_salas']
- _id_campus = _json['id_campus']
- _numero = _json['numero']
- if _id_salas and _id_campus and _numero and request.method == 'POST':
- sql = "UPDATE salas SET id_campus=%s, numero=%s WHERE id_salas=%s"
- data = (_id_salas, _id_campus, _numero)
- cursor.execute(sql, data)
- resp = jsonify('User updated successfully!')
- resp.status_code = 200
- return resp
- return not_found()
- except Exception as e:
- return '200-OK'
RAW Paste Data