arelle.CntlrWebMain
#
Use this module to start Arelle in web server mode
See COPYRIGHT.md for copyright information.
Module Contents#
Classes#
Class to emulate options needed by CntlrCmdLine.run |
Functions#
Called once from main program in CmtlrCmdLine to initiate web server on specified local port. To test WebServer run from source in IIS, use an entry like this: c:\python33\python.exe c:\users\myname\mySourceFolder\arelleCmdLine.py %s |
|
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._os_pid#
‘getpid(…)’
- arelle.CntlrWebMain.GETorPOST#
(‘GET’, ‘POST’)
- arelle.CntlrWebMain.GET#
‘GET’
- arelle.CntlrWebMain.POST#
‘POST’
- arelle.CntlrWebMain.startWebserver(_cntlr, options)#
Called once from main program in CmtlrCmdLine to initiate web server on specified local port. To test WebServer run from source in IIS, use an entry like this: c:\python33\python.exe c:\users\myname\mySourceFolder\arelleCmdLine.py %s
- Parameters:
options (optparse.Values) – OptionParser options from parse_args of main argv arguments (the argument webserver provides hostname and port), port being used to startup the webserver on localhost.
- arelle.CntlrWebMain.cgiInterface(cgiAppPath)#
- arelle.CntlrWebMain.login_form()#
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()#
Login of fields from login form (post to /rest/login). Saves user ID for future use.
- Parameters:
name – User ID
password – Password
- arelle.CntlrWebMain.checkLogin(_user, _password)#
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()#
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()#
Request for icon for URL display (get /favicon.ico).
- Returns:
ico – Icon file for browsers
- arelle.CntlrWebMain.image(imgFile)#
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
- class arelle.CntlrWebMain.Options#
Class to emulate options needed by CntlrCmdLine.run
Initialization
- arelle.CntlrWebMain.supportedViews#
None
- arelle.CntlrWebMain.validation(file=None)#
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, media, viewFile, sourceZipStream=None)#
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()#
Execute versioning diff request for get request to /rest/xbrl/diff.
- Returns:
xml – Versioning report.
- arelle.CntlrWebMain.configure()#
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()#
Stop the web server by get requests to /rest/stopWebServer.
- arelle.CntlrWebMain.testTest()#
- arelle.CntlrWebMain.quickbooksServer()#
Interface to QuickBooks server responding to post requests to /quickbooks/server.asmx.
(Part of QuickBooks protocol, see module CntlrQuickBooks.)
- arelle.CntlrWebMain.quickbooksGLrequest(qbReport=None, file=None)#
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()#
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()#
- arelle.CntlrWebMain.localhostCertificate()#
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()#
Help web page for get requests to /help.
- Returns:
html - Table of CntlrWebMain web API
- arelle.CntlrWebMain.about(arelleImgFile=None)#
- arelle.CntlrWebMain.indexPageREST()#
Index (default) web page for get requests to /.
- Returns:
html - Web page of choices to navigate to /help or /about.
- arelle.CntlrWebMain.indexPageCGI()#
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, script='')#
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, header=None)#
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, media='html')#
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)#