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.1rc1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7b7fd1398d07b7bfc2ed41f16c9249daf27fbcbc6fa7adbb132bcae788d7775 |
|
MD5 | d42a384b681919058859c565428d6426 |
|
BLAKE2b-256 | 5d5c41f26ed3cb5f8d325bb436ce601c2e0eab3508b4ed4cb7073eccef92b3f8 |
Close
Hashes for PyObjectInterface-0.1.1rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 292a889f6ce24eb296749ea0fe75933f64eaf44814b0a4f99ef7439c5e91103a |
|
MD5 | 74e8deaf131ad3af6ce965342fd6641d |
|
BLAKE2b-256 | a2b3acfdc6263e4c5fe01da416d1fc0605f7d76069c2fff0e3ee60abc2c47e49 |