JsonCall is a data model for encapsulating function calls with parameters and data as JSON-serializable objects. It provides methods for populating from JSON, accessing and modifying function names, parameters, data, and error strings, and serializing back to JSON format. It is primarily used for socket communication with MakeHuman.
src/mpfb/services/jsoncall.py
LogService— loggingjson— JSON parsingre— regular expressions for type guessing
Populate the object's properties from a JSON string, handling Windows paths with backslashes.
Set the function name.
Return the function name.
Set a parameter by name.
Get a parameter by name, returning None if not found.
Set the data payload.
Return the data payload.
Set an error message.
Return the error message.
Convert a Python value to a JSON value string representation.
Serialize the entire object to a JSON string, handling Windows paths.
from mpfb.services.jsoncall import JsonCall
call = JsonCall()
call.set_function("getBodyMesh")
call.set_param("format", "binary")
json_string = call.serialize()