The mod_snake Apache API is available as methods within the mod_snake module. The mod_snake module can be imported into any Python module, and the routines accessed directly. The Apache API contains routines which should be accessable by regular modules, CGIs, and embedded Python.
mod_snake.ap_server_root_relative( path)
path - (type string) A path (relative or absolute) to convert, relative to the server's root directory.
The return value is a new string, containing the absolute path on the filesystem. For example, if the server's root directory was /home/jtravis/apache, then ap_server_root_relative('logs/mylog') would return /home/jtravis/apache/logs/mylog.
mod_snake.ap_log_error( level, server, err_string)
level - A level, indicating the severity of the error. Possible values are: APLOG_EMERG, APLOG_ALERT, APLOG_CRIT, APLOG_ERR, APLOG_WARNING, APLOG_NOTICE, APLOG_INFO, APLOG_DEBUG, all of which are available as attributes within the mod_snake module.
server - A server_rec object where the error occurred, or None
err_string - A string (with no terminating '\n') description of the error to be logged.
No values are returned from this function.
mod_snake.ap_getwords_conf( str)
str - a string to parse as arguments to a configuration directive.
A list containing elements of the split-up str is returned.
Apache uses the ap_getword_conf routine to obtain a new argument to a configuration directive. Arguments may be quoted strings or plain strings. The ap_getwords_conf routine returns a list of arguments as parsed from the str argument.
mod_snake.ap_get_server_version()
Returns a string containing the Apache server version
The server version as returned by the function is the same that is sent to clients via the server string. The common form of the server-version is ``Apache/version''. e.g.: ``Apache/2.0a3''
mod_snake.ap_validate_password(pword, hashed)
Returns a true value of the hashed argument is a hashed representation of the password, else false.
This routine compares a plaintext password with a hashed password (which is often created with the htpasswd program, for instance). Hashed passwords are often stored in a database or file as opposed to their plaintext counterparts. This provides safety against theft of the password file.