Create a web interface to interact with a class
Project description
PyObjectInterface
Quickly control any python object through an async web interface.
pip install PyObjectInterface
from PyObjectInterface.WebController import create_WebController
import flask
app = flask.Flask('Demo')
any_python_object = ...
create_WebController(any_python_object, 'any_python_object', app)
app.run()
Go to http://127.0.0.1:5000/webcontroller
Example: Async Robot Control
The above interface was automatically created from:
class DriveMotor:
def __init__(self, pin):
self.pin = pin
self.speed = 0
def forward(self): ...
def stop(self): ...
class Robot:
def __init__(self):
self.left_motor = DriveMotor(1)
self.right_motor = DriveMotor(2)
def forward(self): ...
def stop(self): ...
def left(self): ...
def right(self): ...
Look at PyObjectInterface/examples/example.py for more information.
Advanced Usage and Settings
You can use PyObjectInterface without the WebController.
create_WebController
obj
: Any python objectname: str
: Friendly name for object, generally the name of the variable that refers to the objectflask_app
: return value of flask.Flask()recursion_depth = 5
: maximum layers of subobjects to includecreate_private_interface = True
: ifTrue
creates a/webcontroller/private
page that includes private methods and attributes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for PyObjectInterface-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1dd54d31ada90e9f4035dfdc5c3166aebbdeae9392bcbbe1003a1f3651992fe |
|
MD5 | dad60f57d30e6b6004511c9ea9aecf97 |
|
BLAKE2b-256 | 9c32b05f44f14ac35310df338fe48f2a7b063dd61f5a16a14696e9498e762570 |