utils.log.AdminEmailHandler

class AdminEmailHandler(include_html=False, email_backend=None) [source] This handler sends an email to the site admins for each log message it receives. If the log record contains a request attribute, the full details of the request will be included in the email. The email subject will include the phrase “internal IP” if the client’s IP address is in the INTERNAL_IPS setting; if not, it will include “EXTERNAL IP”. If the log record contains stack trace information, that stack trace will be

utils.http.urlsafe_base64_encode()

urlsafe_base64_encode(s) [source] Encodes a bytestring in base64 for use in URLs, stripping any trailing equal signs.

utils.http.urlsafe_base64_decode()

urlsafe_base64_decode(s) [source] Decodes a base64 encoded string, adding back any trailing equal signs that might have been stripped.

utils.http.urlquote_plus()

urlquote_plus(url, safe='') [source] A version of Python’s urllib.quote_plus() function that can operate on unicode strings. The url is first UTF-8 encoded before quoting. The returned string can safely be used as part of an argument to a subsequent iri_to_uri() call without double-quoting occurring. Employs lazy execution.

utils.http.urlquote()

urlquote(url, safe='/') [source] A version of Python’s urllib.quote() function that can operate on unicode strings. The url is first UTF-8 encoded before quoting. The returned string can safely be used as part of an argument to a subsequent iri_to_uri() call without double-quoting occurring. Employs lazy execution.

utils.http.urlencode()

urlencode(query, doseq=0) [source] A version of Python’s urllib.urlencode() function that can operate on unicode strings. The parameters are first cast to UTF-8 encoded strings and then encoded as per normal.

utils.http.int_to_base36()

int_to_base36(i) [source] Converts a positive integer to a base 36 string. On Python 2 i must be smaller than sys.maxint.

utils.http.http_date()

http_date(epoch_seconds=None) [source] Formats the time to match the RFC 1123 date format as specified by HTTP RFC 7231#section-7.1.1.1. Accepts a floating point number expressed in seconds since the epoch in UTC–such as that outputted by time.time(). If set to None, defaults to the current time. Outputs a string in the format Wdy, DD Mon YYYY HH:MM:SS GMT.

utils.http.cookie_date()

cookie_date(epoch_seconds=None) [source] Formats the time to ensure compatibility with Netscape’s cookie standard. Accepts a floating point number expressed in seconds since the epoch in UTC–such as that outputted by time.time(). If set to None, defaults to the current time. Outputs a string in the format Wdy, DD-Mon-YYYY HH:MM:SS GMT.

utils.http.base36_to_int()

base36_to_int(s) [source] Converts a base 36 string to an integer. On Python 2 the output is guaranteed to be an int and not a long.