Moved plugins up one level and added new view plugins

This commit is contained in:
Joel Collins 2018-12-12 14:58:55 +00:00
parent ac5f26ef6b
commit bde2e9de2a
7 changed files with 53 additions and 36 deletions

View file

@ -0,0 +1,20 @@
from openflexure_microscope.api.utilities import parse_payload
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
from flask import request, Response, escape
import logging
class IdentifyAPI(MicroscopeViewPlugin):
def get(self):
data = self.microscope.plugin.default.identify() # Call a method from our plugin, using the full route
return Response(escape(data))
class HelloWorldAPI(MicroscopeViewPlugin):
def get(self):
data = self.plugin.hello_world() # Call a method from our plugin, using the MicroscopeViewPlugin.plugin shortcut
return Response(data)