Houdini 20.0 Python scripting hou hou.webServer

hou.webServer.APIError class

Raise this exception in apiFunction handlers to indicate an error.

If an apiFunction handler raises this exception, the server will use hou.webServer.errorResponse() to generate a 422 Unprocessable Entity response with a JSON Object body containing an error key with the given error message.

Any other kind of exception in a handler function will generate a generic 500 Internal Server Error. If the server is running in debug mode, the response body will contain a stack trace.

Note

webapiclient.py also has an APIError exception class. If an API function raises an APIError exception from the server, webapiclient will also raise an APIError from the client. If an API function on the server raises another exception and returns 500, webapiclient will also raise APIerror with the contents of the 500 response. You can access api_error.status_code from the client to differentiate between 422 and 500 errors.

Methods

hou.webServer

Classes

Starting and Stopping

Handling Web Requests and Returning Responses

API Calls

  • hou.webServer.apiFunction()

    Decorator for functions that can be called through an API endpoint on Houdini’s web server, returning JSON or binary responses.

  • hou.webServer.APIError

    Raise this exception in apiFunction handlers to indicate an error.