Fixed URL prefix
This commit is contained in:
parent
2b5b0b8744
commit
c9ac940a27
2 changed files with 5 additions and 4 deletions
|
|
@ -80,8 +80,7 @@ CORS(app, resources=r"*")
|
||||||
handler = JSONExceptionHandler(app)
|
handler = JSONExceptionHandler(app)
|
||||||
|
|
||||||
# Attach lab devices
|
# Attach lab devices
|
||||||
labthing = LabThing(app)
|
labthing = LabThing(app, prefix="/api/v2b")
|
||||||
labthing.url_prefix = "/api/v2b"
|
|
||||||
labthing.description = "Test LabThing-based API for OpenFlexure Microscope"
|
labthing.description = "Test LabThing-based API for OpenFlexure Microscope"
|
||||||
|
|
||||||
labthing.register_device(api_microscope, "openflexure_microscope")
|
labthing.register_device(api_microscope, "openflexure_microscope")
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from . import EXTENSION_NAME
|
||||||
|
|
||||||
|
|
||||||
class LabThing(object):
|
class LabThing(object):
|
||||||
def __init__(self, app=None, url_prefix="", description=""):
|
def __init__(self, app=None, prefix="", description=""):
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
self.devices = {}
|
self.devices = {}
|
||||||
|
|
@ -17,7 +17,7 @@ class LabThing(object):
|
||||||
self.resources = []
|
self.resources = []
|
||||||
self.endpoints = set()
|
self.endpoints = set()
|
||||||
|
|
||||||
self.url_prefix = url_prefix
|
self.url_prefix = prefix
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
if app is not None:
|
if app is not None:
|
||||||
|
|
@ -51,6 +51,8 @@ class LabThing(object):
|
||||||
else:
|
else:
|
||||||
raise TypeError("Plugin object must be an instance of BasePlugin")
|
raise TypeError("Plugin object must be an instance of BasePlugin")
|
||||||
|
|
||||||
|
# TODO: Add plugin routes
|
||||||
|
|
||||||
### Resource stuff
|
### Resource stuff
|
||||||
|
|
||||||
def _complete_url(self, url_part, registration_prefix):
|
def _complete_url(self, url_part, registration_prefix):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue