From 43902ee635cf458b7ebc3f4b7ae64324dd75ea82 Mon Sep 17 00:00:00 2001 From: Josef Date: Fri, 10 Jan 2020 17:30:29 +0800 Subject: [PATCH] Closes #34 created http endpoint in server program --- notiframe/Server.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 notiframe/Server.py diff --git a/notiframe/Server.py b/notiframe/Server.py new file mode 100644 index 0000000..b86ea15 --- /dev/null +++ b/notiframe/Server.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +from notiframe import Notiframe +import os +from flask import Flask, render_template, request, redirect, url_for, send_file + +app = Flask(__name__) + +mydir = os.path.dirname(os.path.abspath(__file__)) + +mgr = Notiframe.Manager() + +@app.route('//get_image', methods=['GET']) #when requesting this http endpoint, use eg. /2y7d8s9k/get_image with '2y7d8s9k' being the device id +def display(device_id): + img = mgr.get_image(device_id) + return send_file(img) + +if __name__ == '__main__': + app.run(debug=True, host='0.0.0.0') \ No newline at end of file