Browse Source

Add db download request

master
NGnius 5 years ago
parent
commit
f2925ccd38
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      rxsmserver/__init__.py

+ 5
- 1
rxsmserver/__init__.py View File

@@ -1,5 +1,5 @@
# Created 2019-09-10 by NGnius
from flask import Flask, Blueprint, jsonify, request
from flask import Flask, Blueprint, jsonify, request, send_file
import sqlite3 as dblib
from hashlib import sha512
from os import getcwd
@@ -48,6 +48,10 @@ def create_or_modify_release():

return jsonify({'status':200, 'reason':'Version %s %sd successfully' % (version, operation)}), 200

@app.route('/database', methods=['GET'])
def download_database():
return send_file(database_path, cache_timeout=1, as_attachment=True, attachment_filename="rxsm.sqlite")

# always try to create db table(s)
conn = get_or_create_connection()
cursor = conn.cursor()