💾 Archived View for tris.fyi › pydoc › cgi captured on 2022-03-01 at 15:53:12. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-01-08)
-=-=-=-=-=-=-
Support module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python.
Buffered I/O implementation using an in-memory bytes buffer.
close(self, /) Disable all I/O operations.
detach(self, /) Disconnect this buffer from its underlying raw stream and return it. After the raw stream has been detached, the buffer is in an unusable state.
fileno(self, /) Returns underlying file descriptor if one exists. OSError is raised if the IO object does not use a file descriptor.
flush(self, /) Does nothing.
getbuffer(self, /) Get a read-write view over the contents of the BytesIO object.
getvalue(self, /) Retrieve the entire contents of the BytesIO object.
isatty(self, /) Always returns False. BytesIO objects are not connected to a TTY-like device.
read(self, size=-1, /) Read at most size bytes, returned as a bytes object. If the size argument is negative, read until EOF is reached. Return an empty bytes object at EOF.
read1(self, size=-1, /) Read at most size bytes, returned as a bytes object. If the size argument is negative or omitted, read until EOF is reached. Return an empty bytes object at EOF.
readable(self, /) Returns True if the IO object can be read.
readinto(self, buffer, /) Read bytes into buffer. Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.
readinto1(self, buffer, /)
readline(self, size=-1, /) Next line from the file, as a bytes object. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty bytes object at EOF.
readlines(self, size=None, /) List of bytes objects, each a line from the file. Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.
seek(self, pos, whence=0, /) Change stream position. Seek to byte offset pos relative to position indicated by whence: 0 Start of stream (the default). pos should be >= 0; 1 Current position - pos may be negative; 2 End of stream - pos usually negative. Returns the new absolute position.
seekable(self, /) Returns True if the IO object can be seeked.
tell(self, /) Current file position, an integer.
truncate(self, size=None, /) Truncate the file to at most size bytes. Size defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new size.
writable(self, /) Returns True if the IO object can be written.
write(self, b, /) Write bytes to file. Return the number of bytes written.
writelines(self, lines, /) Write lines to the file. Note that newlines are not added. lines can be any iterable object producing bytes-like objects. This is equivalent to calling write() for each element.
closed = <attribute 'closed' of '_io.BytesIO' objects> True if the file is closed.
A feed-style parser of email.
close(self) Parse all remaining data and return the root message object.
feed(self, data) Push more data into the parser.
Store a sequence of fields, reading multipart/form-data. This class provides naming, typing, files stored on disk, and more. At the top level, it is accessible like a dictionary, whose keys are the field names. (Note: None can occur as a field name.) The items are either a Python list (if there's multiple values) or another FieldStorage or MiniFieldStorage object. If it's a single object, it has the following attributes: name: the field name, if specified; otherwise None filename: the filename, if specified; otherwise None; this is the client side filename, *not* the file name on which it is stored (that's a temporary file you don't deal with) value: the value as a *string*; for file uploads, this transparently reads the file every time you request the value and returns *bytes* file: the file(-like) object from which you can read the data *as bytes* ; None if the data is stored a simple string type: the content-type, or None if not specified type_options: dictionary of options specified on the content-type line disposition: content-disposition, or None if not specified disposition_options: dictionary of corresponding options headers: a dictionary(-like) object (sometimes email.message.Message or a subclass thereof) containing *all* headers The class is subclassable, mostly for the purpose of overriding the make_file() method, which is called internally to come up with a file open for reading and writing. This makes it possible to override the default choice of storing all files in a temporary directory and unlinking them as soon as they have been opened.
getfirst(self, key, default=None) Return the first value received.
getlist(self, key) Return list of received values.
getvalue(self, key, default=None) Dictionary style get() method, including 'value' lookup.
keys(self) Dictionary style keys() method.
make_file(self) Overridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version opens a temporary file for reading and writing, and immediately deletes (unlinks) it. The trick (on Unix!) is that the file can still be used, but it can't be opened by another process, and it will automatically be deleted when it is closed or when the current process terminates. If you want a more permanent file, you derive a class which overrides this method. If you want a visible temporary file that is nevertheless automatically deleted when the script terminates, try defining a __del__ method in a derived class which unlinks the temporary files you have created.
read_binary(self) Internal: read binary data.
read_lines(self) Internal: read lines until EOF or outerboundary.
read_lines_to_eof(self) Internal: read lines until EOF.
read_lines_to_outerboundary(self) Internal: read lines until outerboundary. Data is read as bytes: boundaries and line ends must be converted to bytes for comparisons.
read_multi(self, environ, keep_blank_values, strict_parsing) Internal: read a part that is itself multipart.
read_single(self) Internal: read an atomic part.
read_urlencoded(self) Internal: read data in query string format.
skip_lines(self) Internal: skip lines until outer boundary if defined.
FieldStorageClass = None
bufsize = 8192
get(self, key, default=None) D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
items(self) D.items() -> a set-like object providing a view on D's items
keys(self) D.keys() -> a set-like object providing a view on D's keys
values(self) D.values() -> an object providing a view on D's values
Basic message object. A message object is defined as something that has a bunch of RFC 2822 headers and a payload. It may optionally have an envelope header (a.k.a. Unix-From or From_ header). If the message is a container (i.e. a multipart or a message/rfc822), then the payload is a list of Message objects, otherwise it is a string. Message objects implement part of the `mapping' interface, which assumes there is exactly one occurrence of the header per message. Some headers do in fact appear multiple times (e.g. Received) and for those headers, you must use the explicit API to set or get all the headers. Not all of the mapping methods are implemented.
add_header(self, _name, _value, **_params) Extended header setting. name is the header field to add. keyword arguments can be used to set additional parameters for the header field, with underscores converted to dashes. Normally the parameter will be added as key="value" unless value is None, in which case only the key will be added. If a parameter value contains non-ASCII characters it can be specified as a three-tuple of (charset, language, value), in which case it will be encoded according to RFC2231 rules. Otherwise it will be encoded using the utf-8 charset and a language of ''. Examples: msg.add_header('content-disposition', 'attachment', filename='bud.gif') msg.add_header('content-disposition', 'attachment', filename=('utf-8', '', Fußballer.ppt')) msg.add_header('content-disposition', 'attachment', filename='Fußballer.ppt'))
as_bytes(self, unixfrom=False, policy=None) Return the entire formatted message as a bytes object. Optional 'unixfrom', when true, means include the Unix From_ envelope header. 'policy' is passed to the BytesGenerator instance used to serialize the message; if not specified the policy associated with the message instance is used.
as_string(self, unixfrom=False, maxheaderlen=0, policy=None) Return the entire formatted message as a string. Optional 'unixfrom', when true, means include the Unix From_ envelope header. For backward compatibility reasons, if maxheaderlen is not specified it defaults to 0, so you must override it explicitly if you want a different maxheaderlen. 'policy' is passed to the Generator instance used to serialize the message; if it is not specified the policy associated with the message instance is used. If the message object contains binary data that is not encoded according to RFC standards, the non-compliant data will be replaced by unicode "unknown character" code points.
attach(self, payload) Add the given payload to the current payload. The current payload will always be a list of objects after this method is called. If you want to set the payload to a scalar object, use set_payload() instead.
del_param(self, param, header='content-type', requote=True) Remove the given parameter completely from the Content-Type header. The header will be re-written in place without the parameter or its value. All values will be quoted as necessary unless requote is False. Optional header specifies an alternative to the Content-Type header.
get(self, name, failobj=None) Get a header value. Like __getitem__() but return failobj instead of None when the field is missing.
get_all(self, name, failobj=None) Return a list of all the values for the named field. These will be sorted in the order they appeared in the original message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. If no such fields exist, failobj is returned (defaults to None).
get_boundary(self, failobj=None) Return the boundary associated with the payload if present. The boundary is extracted from the Content-Type header's `boundary' parameter, and it is unquoted.
get_charset(self) Return the Charset instance associated with the message's payload.
get_charsets(self, failobj=None) Return a list containing the charset(s) used in this message. The returned list of items describes the Content-Type headers' charset parameter for this message and all the subparts in its payload. Each item will either be a string (the value of the charset parameter in the Content-Type header of that part) or the value of the 'failobj' parameter (defaults to None), if the part does not have a main MIME type of "text", or the charset is not defined. The list will contain one string for each part of the message, plus one for the container message (i.e. self), so that a non-multipart message will still return a list of length 1.
get_content_charset(self, failobj=None) Return the charset parameter of the Content-Type header. The returned string is always coerced to lower case. If there is no Content-Type header, or if that header has no charset parameter, failobj is returned.
get_content_disposition(self) Return the message's content-disposition if it exists, or None. The return values can be either 'inline', 'attachment' or None according to the rfc2183.
get_content_maintype(self) Return the message's main content type. This is the `maintype' part of the string returned by get_content_type().
get_content_subtype(self) Returns the message's sub-content type. This is the `subtype' part of the string returned by get_content_type().
get_content_type(self) Return the message's content type. The returned string is coerced to lower case of the form `maintype/subtype'. If there was no Content-Type header in the message, the default type as given by get_default_type() will be returned. Since according to RFC 2045, messages always have a default type this will always return a value. RFC 2045 defines a message's default type to be text/plain unless it appears inside a multipart/digest container, in which case it would be message/rfc822.
get_default_type(self) Return the `default' content type. Most messages have a default content type of text/plain, except for messages that are subparts of multipart/digest containers. Such subparts have a default content type of message/rfc822.
get_filename(self, failobj=None) Return the filename associated with the payload if present. The filename is extracted from the Content-Disposition header's `filename' parameter, and it is unquoted. If that header is missing the `filename' parameter, this method falls back to looking for the `name' parameter.
get_param(self, param, failobj=None, header='content-type', unquote=True) Return the parameter value if found in the Content-Type header. Optional failobj is the object to return if there is no Content-Type header, or the Content-Type header has no such parameter. Optional header is the header to search instead of Content-Type. Parameter keys are always compared case insensitively. The return value can either be a string, or a 3-tuple if the parameter was RFC 2231 encoded. When it's a 3-tuple, the elements of the value are of the form (CHARSET, LANGUAGE, VALUE). Note that both CHARSET and LANGUAGE can be None, in which case you should consider VALUE to be encoded in the us-ascii charset. You can usually ignore LANGUAGE. The parameter value (either the returned string, or the VALUE item in the 3-tuple) is always unquoted, unless unquote is set to False. If your application doesn't care whether the parameter was RFC 2231 encoded, it can turn the return value into a string as follows: rawparam = msg.get_param('foo') param = email.utils.collapse_rfc2231_value(rawparam)
get_params(self, failobj=None, header='content-type', unquote=True) Return the message's Content-Type parameters, as a list. The elements of the returned list are 2-tuples of key/value pairs, as split on the `=' sign. The left hand side of the `=' is the key, while the right hand side is the value. If there is no `=' sign in the parameter the value is the empty string. The value is as described in the get_param() method. Optional failobj is the object to return if there is no Content-Type header. Optional header is the header to search instead of Content-Type. If unquote is True, the value is unquoted.
get_payload(self, i=None, decode=False) Return a reference to the payload. The payload will either be a list object or a string. If you mutate the list object, you modify the message's payload in place. Optional i returns that index into the payload. Optional decode is a flag indicating whether the payload should be decoded or not, according to the Content-Transfer-Encoding header (default is False). When True and the message is not a multipart, the payload will be decoded if this header's value is `quoted-printable' or `base64'. If some other encoding is used, or the header is missing, or if the payload has bogus data (i.e. bogus base64 or uuencoded data), the payload is returned as-is. If the message is a multipart and the decode flag is True, then None is returned.
get_unixfrom(self)
is_multipart(self) Return True if the message consists of multiple parts.
items(self) Get all the message's header fields and values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list.
keys(self) Return a list of all the message's header field names. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list.
raw_items(self) Return the (name, value) header pairs without modification. This is an "internal" API, intended only for use by a generator.
replace_header(self, _name, _value) Replace a header. Replace the first matching header found in the message, retaining header order and case. If no matching header was found, a KeyError is raised.
set_boundary(self, boundary) Set the boundary parameter in Content-Type to 'boundary'. This is subtly different than deleting the Content-Type header and adding a new one with a new boundary parameter via add_header(). The main difference is that using the set_boundary() method preserves the order of the Content-Type header in the original message. HeaderParseError is raised if the message has no Content-Type header.
set_charset(self, charset) Set the charset of the payload to a given character set. charset can be a Charset instance, a string naming a character set, or None. If it is a string it will be converted to a Charset instance. If charset is None, the charset parameter will be removed from the Content-Type field. Anything else will generate a TypeError. The message will be assumed to be of type text/* encoded with charset.input_charset. It will be converted to charset.output_charset and encoded properly, if needed, when generating the plain text representation of the message. MIME headers (MIME-Version, Content-Type, Content-Transfer-Encoding) will be added as needed.
set_default_type(self, ctype) Set the `default' content type. ctype should be either "text/plain" or "message/rfc822", although this is not enforced. The default content type is not stored in the Content-Type header.
set_param(self, param, value, header='Content-Type', requote=True, charset=None, language='', replace=False) Set a parameter in the Content-Type header. If the parameter already exists in the header, its value will be replaced with the new value. If header is Content-Type and has not yet been defined for this message, it will be set to "text/plain" and the new parameter and value will be appended as per RFC 2045. An alternate header can be specified in the header argument, and all parameters will be quoted as necessary unless requote is False. If charset is specified, the parameter will be encoded according to RFC 2231. Optional language specifies the RFC 2231 language, defaulting to the empty string. Both charset and language should be strings.
set_payload(self, payload, charset=None) Set the payload to the given value. Optional charset sets the message's default character set. See set_charset() for details.
set_raw(self, name, value) Store name and value in the model without modification. This is an "internal" API, intended only for use by a parser.
set_type(self, type, header='Content-Type', requote=True) Set the main type and subtype for the Content-Type header. type must be a string in the form "maintype/subtype", otherwise a ValueError is raised. This method replaces the Content-Type header, keeping all the parameters in place. If requote is False, this leaves the existing header's quoting as is. Otherwise, the parameters will be quoted (the default). An alternative header can be specified in the header argument. When the Content-Type header is set, we'll always also add a MIME-Version header.
set_unixfrom(self, unixfrom)
values(self) Return a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list.
walk(self) Walk over the message tree, yielding each subpart. The walk is performed in depth-first order. This method is a generator.
Like FieldStorage, for use when no file uploads are possible.
disposition = None
disposition_options = {}
file = None
filename = None
headers = {}
list = None
type = None
type_options = {}
Text I/O implementation using an in-memory buffer. The initial_value argument sets the value of object. The newline argument is like the one of TextIOWrapper's constructor.
close(self, /) Close the IO object. Attempting any further operation after the object is closed will raise a ValueError. This method has no effect if the file is already closed.
detach(...) Separate the underlying buffer from the TextIOBase and return it. After the underlying buffer has been detached, the TextIO is in an unusable state.
fileno(self, /) Returns underlying file descriptor if one exists. OSError is raised if the IO object does not use a file descriptor.
flush(self, /) Flush write buffers, if applicable. This is not implemented for read-only and non-blocking streams.
getvalue(self, /) Retrieve the entire contents of the object.
isatty(self, /) Return whether this is an 'interactive' stream. Return False if it can't be determined.
read(self, size=-1, /) Read at most size characters, returned as a string. If the argument is negative or omitted, read until EOF is reached. Return an empty string at EOF.
readable(self, /) Returns True if the IO object can be read.
readline(self, size=-1, /) Read until newline or EOF. Returns an empty string if EOF is hit immediately.
readlines(self, hint=-1, /) Return a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
seek(self, pos, whence=0, /) Change stream position. Seek to character offset pos relative to position indicated by whence: 0 Start of stream (the default). pos should be >= 0; 1 Current position - pos must be 0; 2 End of stream - pos must be 0. Returns the new absolute position.
seekable(self, /) Returns True if the IO object can be seeked.
tell(self, /) Tell the current file position.
truncate(self, pos=None, /) Truncate size to pos. The pos argument defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new absolute position.
writable(self, /) Returns True if the IO object can be written.
write(self, s, /) Write string to file. Returns the number of characters written, which is always equal to the length of the string.
writelines(self, lines, /) Write a list of lines to stream. Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.
closed = <attribute 'closed' of '_io.StringIO' objects>
encoding = <attribute 'encoding' of '_io._TextIOBase' objects> Encoding of the text stream. Subclasses should override.
errors = <attribute 'errors' of '_io._TextIOBase' objects> The error setting of the decoder or encoder. Subclasses should override.
line_buffering = <attribute 'line_buffering' of '_io.StringIO' objects>
newlines = <attribute 'newlines' of '_io.StringIO' objects>
Character and line based layer over a BufferedIOBase object, buffer. encoding gives the name of the encoding that the stream will be decoded or encoded with. It defaults to locale.getpreferredencoding(False). errors determines the strictness of encoding and decoding (see help(codecs.Codec) or the documentation for codecs.register) and defaults to "strict". newline controls how line endings are handled. It can be None, '', '\n', '\r', and '\r\n'. It works as follows:
close(self, /)
detach(self, /)
fileno(self, /)
flush(self, /)
isatty(self, /)
read(self, size=-1, /)
readable(self, /)
readline(self, size=-1, /)
readlines(self, hint=-1, /) Return a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
reconfigure(self, /, *, encoding=None, errors=None, newline=None, line_buffering=None, write_through=None) Reconfigure the text stream with new parameters. This also does an implicit stream flush.
seek(self, cookie, whence=0, /)
seekable(self, /)
tell(self, /)
truncate(self, pos=None, /)
writable(self, /)
write(self, text, /)
writelines(self, lines, /) Write a list of lines to stream. Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.
buffer = <member 'buffer' of '_io.TextIOWrapper' objects>
closed = <attribute 'closed' of '_io.TextIOWrapper' objects>
encoding = <member 'encoding' of '_io.TextIOWrapper' objects>
errors = <attribute 'errors' of '_io.TextIOWrapper' objects>
line_buffering = <member 'line_buffering' of '_io.TextIOWrapper' objects>
name = <attribute 'name' of '_io.TextIOWrapper' objects>
newlines = <attribute 'newlines' of '_io.TextIOWrapper' objects>
write_through = <member 'write_through' of '_io.TextIOWrapper' objects>
closelog() Close the log file.
dolog(fmt, *args) Write a log message to the log file. See initlog() for docs.
initlog(*allargs) Write a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message).
initlog(*allargs) Write a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message).
nolog(*allargs) Dummy function, assigned to log when logging is disabled.
parse(fp=None, environ=environ({'PYTHONNOUSERSITE': 'true', 'PWD': '/', 'LOGNAME': 'amethyst', 'SYSTEMD_EXEC_PID': '1623040', 'LANG': 'en_US.UTF-8', 'INVOCATION_ID': 'e9f2da78a34743508a504107ea6a61b1', 'USER': 'amethyst', 'TZDIR': '/nix/store/hcrw29p0rv8lkb31yb728kgna4nq1ydd-tzdata-2021c/share/zoneinfo', 'SHLVL': '0', 'LOCALE_ARCHIVE': '/nix/store/gfzp1a6ab4ffwg75bnrycwdrd7cqki1i-glibc-locales-2.33-117/lib/locale/locale-archive', 'STATE_DIRECTORY': '/var/lib/amethyst', 'JOURNAL_STREAM': '8:21393181', 'PATH': '/nix/store/cgxc3jz7idrb1wnb2lard9rvcx6aw2si-python3-3.9.6/bin:/nix/store/42a8c7fk04zjmk0ckvf6ljiggn0hmf4f-amethyst-0.0.1/bin:/nix/store/hg27yaca6208n03wps829lfnnc77jd15-python3-3.9.6-env/bin:/nix/store/jd1y449cf66yx5d1hwyjvc4562b1p1am-coreutils-9.0/bin:/nix/store/jjvw20r6pz3ff7pn91yhvfx8s7izsqan-findutils-4.8.0/bin:/nix/store/df3ff57sbkgbdhc4ar19zs4y0hrhggii-gnugrep-3.7/bin:/nix/store/bpg0ia8nkavzw7s66avi1f9nz72i1p3r-gnused-4.8/bin:/nix/store/w4my56mxgknxk5m0vilgizi37iyibmvb-systemd-249.7/bin:/nix/store/hg27yaca6208n03wps829lfnnc77jd15-python3-3.9.6-env/sbin:/nix/store/jd1y449cf66yx5d1hwyjvc4562b1p1am-coreutils-9.0/sbin:/nix/store/jjvw20r6pz3ff7pn91yhvfx8s7izsqan-findutils-4.8.0/sbin:/nix/store/df3ff57sbkgbdhc4ar19zs4y0hrhggii-gnugrep-3.7/sbin:/nix/store/bpg0ia8nkavzw7s66avi1f9nz72i1p3r-gnused-4.8/sbin:/nix/store/w4my56mxgknxk5m0vilgizi37iyibmvb-systemd-249.7/sbin'}), keep_blank_values=0, strict_parsing=0, separator='&') Parse a query in the environment or from a file (default stdin) Arguments, all optional: fp : file pointer; default: sys.stdin.buffer environ : environment dictionary; default: os.environ keep_blank_values: flag indicating whether blank values in percent-encoded forms should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. separator: str. The symbol to use for separating the query arguments. Defaults to &.
parse_header(line) Parse a Content-type like header. Return the main content-type and a dictionary of options.
parse_multipart(fp, pdict, encoding='utf-8', errors='replace', separator='&') Parse multipart input. Arguments: fp : input file pdict: dictionary containing other parameters of content-type header encoding, errors: request encoding and error handler, passed to FieldStorage Returns a dictionary just like parse_qs(): keys are the field names, each value is a list of values for that field. For non-file fields, the value is a list of strings.
print_arguments()
print_directory() Dump the current directory as HTML.
print_environ(environ=environ({'PYTHONNOUSERSITE': 'true', 'PWD': '/', 'LOGNAME': 'amethyst', 'SYSTEMD_EXEC_PID': '1623040', 'LANG': 'en_US.UTF-8', 'INVOCATION_ID': 'e9f2da78a34743508a504107ea6a61b1', 'USER': 'amethyst', 'TZDIR': '/nix/store/hcrw29p0rv8lkb31yb728kgna4nq1ydd-tzdata-2021c/share/zoneinfo', 'SHLVL': '0', 'LOCALE_ARCHIVE': '/nix/store/gfzp1a6ab4ffwg75bnrycwdrd7cqki1i-glibc-locales-2.33-117/lib/locale/locale-archive', 'STATE_DIRECTORY': '/var/lib/amethyst', 'JOURNAL_STREAM': '8:21393181', 'PATH': '/nix/store/cgxc3jz7idrb1wnb2lard9rvcx6aw2si-python3-3.9.6/bin:/nix/store/42a8c7fk04zjmk0ckvf6ljiggn0hmf4f-amethyst-0.0.1/bin:/nix/store/hg27yaca6208n03wps829lfnnc77jd15-python3-3.9.6-env/bin:/nix/store/jd1y449cf66yx5d1hwyjvc4562b1p1am-coreutils-9.0/bin:/nix/store/jjvw20r6pz3ff7pn91yhvfx8s7izsqan-findutils-4.8.0/bin:/nix/store/df3ff57sbkgbdhc4ar19zs4y0hrhggii-gnugrep-3.7/bin:/nix/store/bpg0ia8nkavzw7s66avi1f9nz72i1p3r-gnused-4.8/bin:/nix/store/w4my56mxgknxk5m0vilgizi37iyibmvb-systemd-249.7/bin:/nix/store/hg27yaca6208n03wps829lfnnc77jd15-python3-3.9.6-env/sbin:/nix/store/jd1y449cf66yx5d1hwyjvc4562b1p1am-coreutils-9.0/sbin:/nix/store/jjvw20r6pz3ff7pn91yhvfx8s7izsqan-findutils-4.8.0/sbin:/nix/store/df3ff57sbkgbdhc4ar19zs4y0hrhggii-gnugrep-3.7/sbin:/nix/store/bpg0ia8nkavzw7s66avi1f9nz72i1p3r-gnused-4.8/sbin:/nix/store/w4my56mxgknxk5m0vilgizi37iyibmvb-systemd-249.7/sbin'})) Dump the shell environment as HTML.
print_environ_usage() Dump a list of environment variables used by CGI as HTML.
print_exception(type=None, value=None, tb=None, limit=None)
print_form(form) Dump the contents of a form as HTML.
test(environ=environ({'PYTHONNOUSERSITE': 'true', 'PWD': '/', 'LOGNAME': 'amethyst', 'SYSTEMD_EXEC_PID': '1623040', 'LANG': 'en_US.UTF-8', 'INVOCATION_ID': 'e9f2da78a34743508a504107ea6a61b1', 'USER': 'amethyst', 'TZDIR': '/nix/store/hcrw29p0rv8lkb31yb728kgna4nq1ydd-tzdata-2021c/share/zoneinfo', 'SHLVL': '0', 'LOCALE_ARCHIVE': '/nix/store/gfzp1a6ab4ffwg75bnrycwdrd7cqki1i-glibc-locales-2.33-117/lib/locale/locale-archive', 'STATE_DIRECTORY': '/var/lib/amethyst', 'JOURNAL_STREAM': '8:21393181', 'PATH': '/nix/store/cgxc3jz7idrb1wnb2lard9rvcx6aw2si-python3-3.9.6/bin:/nix/store/42a8c7fk04zjmk0ckvf6ljiggn0hmf4f-amethyst-0.0.1/bin:/nix/store/hg27yaca6208n03wps829lfnnc77jd15-python3-3.9.6-env/bin:/nix/store/jd1y449cf66yx5d1hwyjvc4562b1p1am-coreutils-9.0/bin:/nix/store/jjvw20r6pz3ff7pn91yhvfx8s7izsqan-findutils-4.8.0/bin:/nix/store/df3ff57sbkgbdhc4ar19zs4y0hrhggii-gnugrep-3.7/bin:/nix/store/bpg0ia8nkavzw7s66avi1f9nz72i1p3r-gnused-4.8/bin:/nix/store/w4my56mxgknxk5m0vilgizi37iyibmvb-systemd-249.7/bin:/nix/store/hg27yaca6208n03wps829lfnnc77jd15-python3-3.9.6-env/sbin:/nix/store/jd1y449cf66yx5d1hwyjvc4562b1p1am-coreutils-9.0/sbin:/nix/store/jjvw20r6pz3ff7pn91yhvfx8s7izsqan-findutils-4.8.0/sbin:/nix/store/df3ff57sbkgbdhc4ar19zs4y0hrhggii-gnugrep-3.7/sbin:/nix/store/bpg0ia8nkavzw7s66avi1f9nz72i1p3r-gnused-4.8/sbin:/nix/store/w4my56mxgknxk5m0vilgizi37iyibmvb-systemd-249.7/sbin'})) Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form.
valid_boundary(s)
logfile = ''
logfp = None
maxlen = 0