module documentation

Utility implementations of IResource.

Function errorPage Build a resource that responds to all requests with a particular HTTP status code and an HTML body containing some descriptive text. This is useful for rendering simple error pages.
Function forbidden Generate an IResource with a 403 Forbidden status code.
Function notFound Generate an IResource with a 404 Not Found status code.
Class _ErrorPage _ErrorPage is a resource that responds to all requests with a particular (parameterized) HTTP status code and an HTML body containing some descriptive text. This is useful for rendering simple error pages.
def errorPage(code: int, brief: str, detail: str) -> _ErrorPage: (source)

Build a resource that responds to all requests with a particular HTTP status code and an HTML body containing some descriptive text. This is useful for rendering simple error pages.

The resource dynamically handles all paths below it. Use IResource.putChild() to override a specific path.

Parameters
code:intAn integer HTTP status code which will be used for the response.
brief:strA short string which will be included in the response body as the page title.
detail:strA longer string which will be included in the response body.
Returns
_ErrorPageAn IResource
def forbidden(brief: str = 'Forbidden Resource', message: str = 'Sorry, resource is forbidden.') -> IResource: (source)

Generate an IResource with a 403 Forbidden status code.

Parameters
brief:strA longer string displayed in the page body.
message:strUndocumented
Returns
IResourceAn IResource
See Also
twisted.web.pages.errorPage
def notFound(brief: str = 'No Such Resource', message: str = 'Sorry. No luck finding that resource.') -> IResource: (source)

Generate an IResource with a 404 Not Found status code.

Parameters
brief:strA longer string displayed in the page body.
message:strUndocumented
Returns
IResourceAn IResource
See Also
twisted.web.pages.errorPage