From f2925ccd3868316cc6b87909f0dc08ab19535a11 Mon Sep 17 00:00:00 2001 From: NGnius Date: Wed, 11 Sep 2019 09:49:15 -0400 Subject: [PATCH] Add db download request --- rxsmserver/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rxsmserver/__init__.py b/rxsmserver/__init__.py index e91ec64..0d1d863 100644 --- a/rxsmserver/__init__.py +++ b/rxsmserver/__init__.py @@ -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()