def photo(): print("photo requested") db = Database() db.add_telecommand("TAKE PHOTO") sleep(3) img_path = f"static/{db.get_last_photo_name()}" return send_file(img_path, mimetype='image/gif')
def post(self): received = request.get_json() if received is None: return {'status': 'JSON payload is empty!'} else: tc = received['telecommand'] if tc is None: return {'status': 'telecommand field empty!'} print(tc) db = Database() db.add_telecommand(tc) return {'status': f'telecommand ({tc}) added'}