cgitb.enable()

cgitb.enable(display=1, logdir=None, context=5, format="html") This function causes the cgitb module to take over the interpreter’s default handling for exceptions by setting the value of sys.excepthook. The optional argument display defaults to 1 and can be set to 0 to suppress sending the traceback to the browser. If the argument logdir is present, the traceback reports are written to files. The value of logdir should be a directory where these files will be placed. The optional argument c

cgi.print_directory()

cgi.print_directory() Format the current directory in HTML.

cgi.print_form()

cgi.print_form(form) Format a form in HTML.

cgi.print_environ_usage()

cgi.print_environ_usage() Print a list of useful (used by CGI) environment variables in HTML.

cgi.parse_qsl()

cgi.parse_qsl(qs, keep_blank_values=False, strict_parsing=False) This function is deprecated in this module. Use urllib.parse.parse_qsl() instead. It is maintained here only for backward compatibility.

cgi.parse()

cgi.parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False) Parse a query in the environment or from a file (the file defaults to sys.stdin). The keep_blank_values and strict_parsing parameters are passed to urllib.parse.parse_qs() unchanged.

cgi.parse_multipart()

cgi.parse_multipart(fp, pdict) Parse input of type multipart/form-data (for file uploads). Arguments are fp for the input file and pdict for a dictionary containing other parameters in the Content-Type header. Returns a dictionary just like urllib.parse.parse_qs() keys are the field names, each value is a list of values for that field. This is easy to use but not much good if you are expecting megabytes to be uploaded — in that case, use the FieldStorage class instead which is much more flex

cgi.FieldStorage.getfirst()

FieldStorage.getfirst(name, default=None) This method always returns only one value associated with form field name. The method returns only the first value in case that more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser and should not be counted on. [1] If no such form field or value exists then the method returns the value specified by the optional parameter default. This parameter defaults to None if not sp

cgi.parse_header()

cgi.parse_header(string) Parse a MIME header (such as Content-Type) into a main value and a dictionary of parameters.

cgi.FieldStorage.getlist()

FieldStorage.getlist(name) This method always returns a list of values associated with form field name. The method returns an empty list if no such form field or value exists for name. It returns a list consisting of one item if only one such value exists.