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.1rc0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b346027a51833e4c249835da4a6545511b91561796e1f7e0a03b09ed83a9aeba |
|
MD5 | 20abea1f66d3921e4c00d906e9a420f9 |
|
BLAKE2b-256 | 69755a78832ed72ba973d8afeb85e443081f0b6147f7cc61af3c8ceddce352f4 |
Close
Hashes for PyObjectInterface-0.1.1rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54304bc6a37bbda7518cb0ff674f5a77d94ccdc88e326dd102db0da551d677b2 |
|
MD5 | 0d829deb056b1f1dc601c8d3e81b7e34 |
|
BLAKE2b-256 | b86f661b6081fdf8e0d5155de81e66a09b7ba30607be76ea92a360d76a1474f4 |