arelle.CntlrWebMain¶
Use this module to start Arelle in web server mode.
See COPYRIGHT.md for copyright information.
Module Contents¶
Functions¶
Raise a 400 HTTPResponse if any pipe-separated plug-in reference is a URL. |
|
Called once from main program in CmtlrCmdLine to initiate web server on specified local port. |
|
Request for a login form (get to /rest/login). Corresponds to login from other providers of XBRL validation services, but this version of Arelle does not perform accounting or charges for validation requests, so the login is ignored. |
|
Login of fields from login form (post to /rest/login). Saves user ID for future use. |
|
Save user ID for future use. Password not currently processed. |
|
Request to log out (get /rest/logout). Removes any proior user ID from session. |
|
Request for icon for URL display (get /favicon.ico). |
|
Request for an image file for URL display (get /images/ |
|
REST request to validate, by get or post, to URL patterns including /rest/xbrl/<file:path>/{open|close|validation|DTS…}, and /rest/xbrl/{view|open|close}. Sets up CntrlCmdLine options for request, performed by runOptionsAndGetResult using CntlrCmdLine.run with get or post arguments. |
|
Execute request according to options, for result in media, with posted file in sourceZipStream, if any. |
|
Execute versioning diff request for get request to /rest/xbrl/diff. |
|
Set up features for get requests to /rest/configure, e.g., proxy or plug-ins. |
|
Stop the web server by get requests to /rest/stopWebServer. |
|
Interface to QuickBooks server responding to post requests to /quickbooks/server.asmx. |
|
Initiate request to QuickBooks server for get requests to /rest/quickbooks/ |
|
Poll for QuickBooks protocol responses for get requests to /rest/quickbooks/response. |
|
Interface to QuickBooks server responding to get requests for a host certificate /quickbooks/localhost.crt or /localhost.crt. |
|
Help web page for get requests to /help. |
|
Index (default) web page for get requests to /. |
|
Default web page response for get CGI request with no parameters. |
|
Wraps body html string in a css-styled html web page |
|
Wraps lines of text into a one-column table (for display of text results of operations, such as processing messages and status, to web browser). Replaces any & with & and < with <. |
|
Wraps lines of error text into specified media type for return of result to a request. |
|
Data¶
API¶
- arelle.CntlrWebMain._: arelle.typing.TypeGetText¶
None
- arelle.CntlrWebMain.Options¶
None
- arelle.CntlrWebMain._os_pid¶
‘getpid(…)’
- arelle.CntlrWebMain.GETorPOST¶
(‘GET’, ‘POST’)
- arelle.CntlrWebMain.GET¶
‘GET’
- arelle.CntlrWebMain.POST¶
‘POST’
- arelle.CntlrWebMain._CNTLR: arelle.CntlrCmdLine.CntlrCmdLine | None¶
None
- arelle.CntlrWebMain.getCntlr() arelle.CntlrCmdLine.CntlrCmdLine¶
- arelle.CntlrWebMain.setCntlr(cntlr: arelle.CntlrCmdLine.CntlrCmdLine) None¶
- arelle.CntlrWebMain.getLogHandler() arelle.logging.handlers.LogToBufferHandler.LogToBufferHandler¶
- arelle.CntlrWebMain._RUNTIME_OPTIONS: arelle.RuntimeOptions.RuntimeOptions | None¶
None
- arelle.CntlrWebMain.getRuntimeOptions() arelle.RuntimeOptions.RuntimeOptions¶
- arelle.CntlrWebMain.setRuntimeOptions(runtimeOptions: arelle.RuntimeOptions.RuntimeOptions) None¶
- arelle.CntlrWebMain._URL_SCHEME¶
‘compile(…)’
- arelle.CntlrWebMain._PLUGIN_PREFIX_CHARS¶
‘+-~’
- arelle.CntlrWebMain._rejectRemotePlugins(rawValue: str) None¶
Raise a 400 HTTPResponse if any pipe-separated plug-in reference is a URL.
The Arelle webserver is intended for trusted callers only and must not fetch and execute arbitrary Python from attacker supplied URLs. Local plug-in references are still accepted.
- arelle.CntlrWebMain.startWebserver(cntlr: arelle.CntlrCmdLine.CntlrCmdLine, options: arelle.RuntimeOptions.RuntimeOptions) bottle.Bottle | None¶
Called once from main program in CmtlrCmdLine to initiate web server on specified local port.
- arelle.CntlrWebMain.cgiInterface(cgiAppPath: str) str | bottle.HTTPResponse¶
- arelle.CntlrWebMain.login_form() str¶
Request for a login form (get to /rest/login). Corresponds to login from other providers of XBRL validation services, but this version of Arelle does not perform accounting or charges for validation requests, so the login is ignored.
- Returns:
str – HTML login form to enter and submit via method=POST these fields: name, password
- arelle.CntlrWebMain.login_submit() str¶
Login of fields from login form (post to /rest/login). Saves user ID for future use.
- Parameters:
name – User ID
password – Password
- arelle.CntlrWebMain.user: str | None¶
None
- arelle.CntlrWebMain.checkLogin(_user: str | None, _password: str | None) bool¶
Save user ID for future use. Password not currently processed.
- Returns:
bool – True (for now, future user may interact with authentication and accounting services.)
- arelle.CntlrWebMain.logout() str¶
Request to log out (get /rest/logout). Removes any proior user ID from session.
- Returns:
html – Message that user has logged out
- arelle.CntlrWebMain.arelleIcon() bottle.HTTPResponse¶
Request for icon for URL display (get /favicon.ico).
- Returns:
ico – Icon file for browsers
- arelle.CntlrWebMain.image(imgFile: str) bottle.HTTPResponse¶
Request for an image file for URL display (get /images/
). - Returns:
image file – Requested image file from images directory of application for browsers
- arelle.CntlrWebMain.validationOptions¶
None
- arelle.CntlrWebMain.validationKeyVarName¶
None
- arelle.CntlrWebMain.supportedViews¶
None
- arelle.CntlrWebMain.validation(file: str | None = None) str | bytes¶
REST request to validate, by get or post, to URL patterns including /rest/xbrl/<file:path>/{open|close|validation|DTS…}, and /rest/xbrl/{view|open|close}. Sets up CntrlCmdLine options for request, performed by runOptionsAndGetResult using CntlrCmdLine.run with get or post arguments.
- Returns:
html, xhtml, xml, json, text – Return per media type argument and request arguments
- arelle.CntlrWebMain.runOptionsAndGetResult(options: arelle.RuntimeOptions.RuntimeOptions, media: str, viewFile: arelle.FileSource.FileNamedStringIO | None, sourceZipStream: arelle.FileSource.FileNamedBytesIO | None = None) str | bytes¶
Execute request according to options, for result in media, with posted file in sourceZipStream, if any.
- Returns:
html, xml, csv, text – Return per media type argument and request arguments
- arelle.CntlrWebMain.diff() str¶
Execute versioning diff request for get request to /rest/xbrl/diff.
- Returns:
xml – Versioning report.
- arelle.CntlrWebMain.configure() str¶
Set up features for get requests to /rest/configure, e.g., proxy or plug-ins.
- Returns:
html – Status of configuration request (e.g., proxy or plug-ins).
- arelle.CntlrWebMain.stopWebServer() str¶
Stop the web server by get requests to /rest/stopWebServer.
- arelle.CntlrWebMain.testTest() str¶
- arelle.CntlrWebMain.quickbooksServer() str¶
Interface to QuickBooks server responding to post requests to /quickbooks/server.asmx.
(Part of QuickBooks protocol, see module CntlrQuickBooks.)
- arelle.CntlrWebMain.quickbooksGLrequest(qbReport: str | None = None, file: str | None = None) str¶
Initiate request to QuickBooks server for get requests to /rest/quickbooks/
/xbrl-gl/… .- Returns:
html, xml, csv, text – Return per media type argument and request arguments
- arelle.CntlrWebMain.quickbooksGLresponse() str | bytes¶
Poll for QuickBooks protocol responses for get requests to /rest/quickbooks/response.
- Returns:
html, xml, csv, text – Return per media type argument and request arguments, if response is ready, otherwise javascript to requery this get request periodicially.
- arelle.CntlrWebMain.quickbooksWebPage() str¶
- arelle.CntlrWebMain.localhostCertificate() str¶
Interface to QuickBooks server responding to get requests for a host certificate /quickbooks/localhost.crt or /localhost.crt.
(Supports QuickBooks protocol.)
- Returns:
self-signed certificate
- arelle.CntlrWebMain.helpREST() str¶
Help web page for get requests to /help.
- Returns:
html - Table of CntlrWebMain web API
- arelle.CntlrWebMain.about(arelleImgFile: str | None = None) str¶
- arelle.CntlrWebMain.indexPageREST() str¶
Index (default) web page for get requests to /.
- Returns:
html - Web page of choices to navigate to /help or /about.
- arelle.CntlrWebMain.indexPageCGI() str¶
Default web page response for get CGI request with no parameters.
- Returns:
html - Web page of choices to navigate to ?help or ?about.
- arelle.CntlrWebMain.htmlBody(body: str, script: str = '') str¶
Wraps body html string in a css-styled html web page
- Parameters:
body (html str) – Contents for the element
script (javascript str) – Script to insert in generated html web page (such as a timed reload script)
- Returns:
html - Web page of choices to navigate to /help or /about.
- arelle.CntlrWebMain.tableRows(lines: collections.abc.Iterable[str], header: str | None = None) str¶
Wraps lines of text into a one-column table (for display of text results of operations, such as processing messages and status, to web browser). Replaces any & with & and < with <.
- Parameters:
lines ([str]) – Sequence (list or tuple) of line strings.
header (str) – Optional header text for top row of table.
- Returns:
html -
html string.
- arelle.CntlrWebMain.errorReport(errors: list[str], media: str = 'html') str¶
Wraps lines of error text into specified media type for return of result to a request.
- Parameters:
errors ([str]) – Sequence (list or tuple) of error strings.
media (str) – Type of result requestd.
- Returns:
html -
html string.
- arelle.CntlrWebMain.multipartResponse(parts: tuple[tuple[str, str, str], ...]) str¶