commit 642bb02d3297e77c19a3b44f6ab14ee8bb831d65 Author: Illia Chub Date: Tue Aug 10 16:19:58 2021 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py new file mode 100644 index 0000000..979c2ab --- /dev/null +++ b/main.py @@ -0,0 +1,28 @@ +from flask import Flask +from flask_restful import Resource, Api, reqparse +import pyodbc + +def main(): + + global databaseConnectionDescriptor + global databaseSelector + + app = Flask(__name__) + storage = Api(app) + + if __name__ == '__main__': + app.run(port=5051, debug=False) + + +def ExecuteArbitraryQuery(databaseSelector, query: str): + databaseSelector.execute(query) + +def InsertRowIntoTable(databaseSelector, table: str, rows: str, values: str): + databaseSelector.execute( + "INSERT INTO " + table + "(" + rows + ")" + + "VALUES" + "(" + values + ")" + ) + +databaseConnectionDescriptor = pyodbc.connect('DRIVER={Devart ODBC Driver for SQLite};Direct=True;Database=selfprivacy-storage;String Types= Unicode') +databaseSelector = databaseConnectionDescriptor.cursor() +main() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..850e71d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pyodbc +flask +flask_restful \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..4a2fce4 --- /dev/null +++ b/setup.py @@ -0,0 +1,7 @@ +from distutils.core import setup + +setup( + name='selfprivacy-storage-api', + version='0.0.1', + scripts=['main.py',], +) \ No newline at end of file