Python Environment Reference

Quick reference to the Python environment settings.

Cookies
Variable Means what
Usage: Note that cookies are set before sending "Content-type:text/html\r\n\r\n".
Expires The date the cookie will expire. If this is blank, the cookie will expire when the visitor quits the browser.
Domain The domain name of the site that sets the cookie.
Path The path to the directory or web page that sets the cookie. This may be blank if you want to retrieve the cookie from any directory or page.
Secure If this field contains the word "secure" the cookie may only be retrieved with a secure server. If this field is blank, no such restriction exists.
Name=Value Cookies are set and retrieved in the form of key and value pairs.
HTTP headers
Variable Means what
Content-type: A MIME string defining the format of the file being returned. Example is "Content-type:text/html"".
Expires: Date The date the information becomes invalid. It is used by the browser to decide when a page needs to be refreshed. A valid date string is in the format 01 Jan 1998 12:00:00 GMT.
Location: URL The URL that is returned instead of the URL requested. You can use this field to redirect a request to any file.
Last-modified: Date The date of last modification of the resource.
Content-length: N The length, in bytes, of the data being returned. The browser uses this value to report the estimated download time for a file.
Set-Cookie: String Set the cookie passed through the string.
CGI variables
Variable Means what
CONTENT_TYPE The data type of the content. Used when the client is sending attached content to the server. For example, file upload.
CONTENT_LENGTH The length of the query information. It is available for POST requests only.
HTTP_COOKIE Returns the set cookies in the form of key and value pairs.
HTTP_USER_AGENT The User-Agent request-header field contains information about the user agent originating the request. It is name of the web browser.
PATH_INFO The path to the CGI script.
QUERY_STRING The URL-encoded information that is sent with GET method request.
REMOTE_ADDR The IP address of the remote host making the request. This is useful logging or for authentication.
REMOTE_HOST The fully qualified name of the host making the request. If this information is not available, then REMOTE_ADDR can be used to get IR address.
REQUEST_METHOD The method used to make the request. The most common methods are GET and POST.
SCRIPT_FILENAME The full path to the CGI script.
SCRIPT_NAME The name of the CGI script.
SERVER_NAME The server's hostname or IP Address.
SERVER_SOFTWARE The name and version of the software the server is running.

More: