Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 1 | \section{Standard Module \module{BaseHTTPServer}} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 2 | \label{module-BaseHTTPServer} |
| 3 | \stmodindex{BaseHTTPServer} |
| 4 | |
| 5 | \indexii{WWW}{server} |
| 6 | \indexii{HTTP}{protocol} |
| 7 | \index{URL} |
| 8 | \index{httpd} |
| 9 | |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 10 | |
| 11 | This module defines two classes for implementing HTTP servers |
| 12 | (web servers). Usually, this module isn't used directly, but is used |
| 13 | as a basis for building functioning web servers. See the |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 14 | \module{SimpleHTTPServer} and \module{CGIHTTPServer} modules. |
| 15 | \refstmodindex{SimpleHTTPServer} |
| 16 | \refstmodindex{CGIHTTPServer} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 17 | |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 18 | The first class, \class{HTTPServer}, is a |
| 19 | \class{SocketServer.TCPServer} subclass. It creates and listens at the |
| 20 | web socket, dispatching the requests to a handler. Code to create and |
| 21 | run the server looks like this: |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 22 | |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 23 | \begin{verbatim} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 24 | def run(server_class=BaseHTTPServer.HTTPServer, |
| 25 | handler_class=BaseHTTPServer.BaseHTTPRequestHandler): |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 26 | server_address = ('', 8000) |
| 27 | httpd = server_class(server_address, handler_class) |
| 28 | httpd.serve_forever() |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 29 | \end{verbatim} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 30 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 31 | \begin{classdesc}{HTTPServer}{server_address, RequestHandlerClass} |
| 32 | This class builds on the \class{TCPServer} class by |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 33 | storing the server address as instance |
| 34 | variables named \member{server_name} and \member{server_port}. The |
| 35 | server is accessible by the handler, typically through the handler's |
| 36 | \member{server} instance variable. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 37 | \end{classdesc} |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 38 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 39 | \begin{classdesc}{BaseHTTPRequestHandler}{request, client_address, server} |
| 40 | This class is used |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 41 | to handle the HTTP requests that arrive at the server. By itself, |
| 42 | it cannot respond to any actual HTTP requests; it must be subclassed |
| 43 | to handle each request method (e.g. GET or POST). |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 44 | \class{BaseHTTPRequestHandler} provides a number of class and instance |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 45 | variables, and methods for use by subclasses. |
| 46 | |
| 47 | The handler will parse the request and the headers, then call a |
| 48 | method specific to the request type. The method name is constructed |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 49 | from the request. For example, for the request method \samp{SPAM}, the |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 50 | \method{do_SPAM()} method will be called with no arguments. All of |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 51 | the relevant information is stored in instance variables of the |
| 52 | handler. Subclasses should not need to override or extend the |
| 53 | \method{__init__()} method. |
| 54 | \end{classdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 55 | |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 56 | |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 57 | \class{BaseHTTPRequestHandler} has the following instance variables: |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 58 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 59 | \begin{memberdesc}{client_address} |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 60 | Contains a tuple of the form \code{(\var{host}, \var{port})} referring |
| 61 | to the client's address. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 62 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 63 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 64 | \begin{memberdesc}{command} |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 65 | Contains the command (request type). For example, \code{'GET'}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 66 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 67 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 68 | \begin{memberdesc}{path} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 69 | Contains the request path. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 70 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 71 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 72 | \begin{memberdesc}{request_version} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 73 | Contains the version string from the request. For example, |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 74 | \code{'HTTP/1.0'}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 75 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 76 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 77 | \begin{memberdesc}{headers} |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 78 | Holds an instance of the class specified by the \member{MessageClass} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 79 | class variable. This instance parses and manages the headers in |
| 80 | the HTTP request. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 81 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 82 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 83 | \begin{memberdesc}{rfile} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 84 | Contains an input stream, positioned at the start of the optional |
| 85 | input data. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 86 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 87 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 88 | \begin{memberdesc}{wfile} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 89 | Contains the output stream for writing a response back to the client. |
| 90 | Proper adherance to the HTTP protocol must be used when writing |
| 91 | to this stream. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 92 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 93 | |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 94 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 95 | \class{BaseHTTPRequestHandler} has the following class variables: |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 96 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 97 | \begin{memberdesc}{server_version} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 98 | Specifies the server software version. You may want to override |
| 99 | this. |
| 100 | The format is multiple whitespace-separated strings, |
| 101 | where each string is of the form name[/version]. |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 102 | For example, \code{'BaseHTTP/0.2'}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 103 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 104 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 105 | \begin{memberdesc}{sys_version} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 106 | Contains the Python system version, in a form usable by the |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 107 | \member{version_string} method and the \member{server_version} class |
| 108 | variable. For example, \code{'Python/1.4'}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 109 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 110 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 111 | \begin{memberdesc}{error_message_format} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 112 | Specifies a format string for building an error response to the |
| 113 | client. It uses parenthesized, keyed format specifiers, so the |
| 114 | format operand must be a dictionary. The \var{code} key should |
| 115 | be an integer, specifing the numeric HTTP error code value. |
| 116 | \var{message} should be a string containing a (detailed) error |
| 117 | message of what occurred, and \var{explain} should be an |
| 118 | explanation of the error code number. Default \var{message} |
| 119 | and \var{explain} values can found in the \var{responses} |
| 120 | class variable. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 121 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 122 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 123 | \begin{memberdesc}{protocol_version} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 124 | This specifies the HTTP protocol version used in responses. |
| 125 | Typically, this should not be overridden. Defaults to |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 126 | \code{'HTTP/1.0'}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 127 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 128 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 129 | \begin{memberdesc}{MessageClass} |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 130 | Specifies a \class{rfc822.Message}-like class to parse HTTP |
| 131 | headers. Typically, this is not overridden, and it defaults to |
| 132 | \class{mimetools.Message}. |
| 133 | \withsubitem{(in module mimetools)}{\ttindex{Message}} |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 134 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 135 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 136 | \begin{memberdesc}{responses} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 137 | This variable contains a mapping of error code integers to two-element |
| 138 | tuples containing a short and long message. For example, |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 139 | \code{\{\var{code}: (\var{shortmessage}, \var{longmessage})\}}. The |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 140 | \var{shortmessage} is usually used as the \var{message} key in an |
| 141 | error response, and \var{longmessage} as the \var{explain} key |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 142 | (see the \member{error_message_format} class variable). |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 143 | \end{memberdesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 144 | |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 145 | |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 146 | A \class{BaseHTTPRequestHandler} instance has the following methods: |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 147 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 148 | \begin{methoddesc}{handle}{} |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 149 | Overrides the superclass' \method{handle()} method to provide the |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 150 | specific handler behavior. This method will parse and dispatch |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 151 | the request to the appropriate \method{do_*()} method. |
| 152 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 153 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 154 | \begin{methoddesc}{send_error}{code\optional{, message}} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 155 | Sends and logs a complete error reply to the client. The numeric |
| 156 | \var{code} specifies the HTTP error code, with \var{message} as |
| 157 | optional, more specific text. A complete set of headers is sent, |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 158 | followed by text composed using the \member{error_message_format} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 159 | class variable. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 160 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 161 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 162 | \begin{methoddesc}{send_response}{code\optional{, message}} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 163 | Sends a response header and logs the accepted request. The HTTP |
| 164 | response line is sent, followed by \emph{Server} and \emph{Date} |
| 165 | headers. The values for these two headers are picked up from the |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 166 | \method{version_string()} and \method{date_time_string()} methods, |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 167 | respectively. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 168 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 169 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 170 | \begin{methoddesc}{send_header}{keyword, value} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 171 | Writes a specific MIME header to the output stream. \var{keyword} |
| 172 | should specify the header keyword, with \var{value} specifying |
| 173 | its value. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 174 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 175 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 176 | \begin{methoddesc}{end_headers}{} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 177 | Sends a blank line, indicating the end of the MIME headers in |
| 178 | the response. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 179 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 180 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 181 | \begin{methoddesc}{log_request}{\optional{code\optional{, size}}} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 182 | Logs an accepted (successful) request. \var{code} should specify |
| 183 | the numeric HTTP code associated with the response. If a size of |
| 184 | the response is available, then it should be passed as the |
| 185 | \var{size} parameter. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 186 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 187 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 188 | \begin{methoddesc}{log_error}{...} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 189 | Logs an error when a request cannot be fulfilled. By default, |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 190 | it passes the message to \method{log_message()}, so it takes the |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 191 | same arguments (\var{format} and additional values). |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 192 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 193 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 194 | \begin{methoddesc}{log_message}{format, ...} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 195 | Logs an arbitrary message to \code{sys.stderr}. This is typically |
| 196 | overridden to create custom error logging mechanisms. The |
| 197 | \var{format} argument is a standard printf-style format string, |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 198 | where the additional arguments to \method{log_message()} are applied |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 199 | as inputs to the formatting. The client address and current date |
| 200 | and time are prefixed to every message logged. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 201 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 202 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 203 | \begin{methoddesc}{version_string}{} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 204 | Returns the server software's version string. This is a combination |
Fred Drake | f9e1f65 | 1998-03-14 07:00:41 +0000 | [diff] [blame] | 205 | of the \member{server_version} and \member{sys_version} class variables. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 206 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 207 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 208 | \begin{methoddesc}{date_time_string}{} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 209 | Returns the current date and time, formatted for a message header. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 210 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 211 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 212 | \begin{methoddesc}{log_data_time_string}{} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 213 | Returns the current date and time, formatted for logging. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 214 | \end{methoddesc} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 215 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 216 | \begin{methoddesc}{address_string}{} |
Guido van Rossum | 9cb6480 | 1997-12-29 20:01:55 +0000 | [diff] [blame] | 217 | Returns the client address, formatted for logging. A name lookup |
| 218 | is performed on the client's IP address. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 219 | \end{methoddesc} |