Closes #34 created http endpoint in server program
parent
09f61f0015
commit
43902ee635
@ -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('/<device_id>/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')
|
||||
Loading…
Reference in new issue