temper-python
temper-python copied to clipboard
Add an HTTP server that outputs the same as the CLI interface
This pull request contains an HTTP server called httpserver.py which acts exactly like cli.py but will serve HTTP requests on a specified port and respond with the current data. It holds a connection to any USB devices rather than re-opening them each time.
@daviessm Just curious, would using the http server block cli access, is this a one or the other choice? Thanks
@rdica It's one or the other. The HTTP server will take a connection to the device(s) and hold on to them.
The reason for this is that in my setup the devices regularly fall off the bus if more than one application tries to access them at once: I can now push them all through the single HTTP server.
If you don't want exclusive use, then invoke the cli command from within a python program with a http server of some flavour.
I've been doing exactly that for the last 5 years using a flask microservice for temper USBs all around the place.
My feeling on this is that webserver functionality should be separate.
Since this is package is available on pypi, it can be imported and used however someone wants, potentially as a new project temper-python-webserver
.
I think there are many people who will use this and don't want a webserver. Why give all those people the overhead/security risks?
I agree with @davet2001 .