diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2010-10-28 18:28:38 +0100 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2010-10-28 18:28:38 +0100 |
commit | 92c413712914c2c71b508c3f142f2482a766ad0e (patch) | |
tree | a58e33430857498c58f85d5386228f770b962462 /logutils/http.py | |
parent | 44c0c75e67086a0a9b22e4e614c7774d44d9fe84 (diff) | |
download | logutils-git-0.2.tar.gz |
Changes for 0.20.2
Diffstat (limited to 'logutils/http.py')
-rw-r--r-- | logutils/http.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/logutils/http.py b/logutils/http.py index cb95159..c3c6c57 100644 --- a/logutils/http.py +++ b/logutils/http.py @@ -4,11 +4,20 @@ class HTTPHandler(logging.Handler): """ A class which sends records to a Web server, using either GET or POST semantics. + + :param host: The Web server to connect to. + :param url: The URL to use for the connection. + :param method: The HTTP method to use. GET and POST are supported. + :param secure: set to True if HTTPS is to be used. + :param credentials: Set to a username/password tuple if desired. If + set, a Basic authentication header is sent. WARNING: + if using credentials, make sure `secure` is `True` + to avoid sending usernames and passwords in + cleartext over the wire. """ def __init__(self, host, url, method="GET", secure=False, credentials=None): """ - Initialize the instance with the host, the request URL, and the method - ("GET" or "POST") + Initialize an instance. """ logging.Handler.__init__(self) method = method.upper() @@ -25,6 +34,8 @@ class HTTPHandler(logging.Handler): Default implementation of mapping the log record into a dict that is sent as the CGI data. Overwrite in your class. Contributed by Franz Glasner. + + :param record: The record to be mapped. """ return record.__dict__ @@ -33,6 +44,8 @@ class HTTPHandler(logging.Handler): Emit a record. Send the record to the Web server as a percent-encoded dictionary + + :param record: The record to be emitted. """ try: import http.client, urllib.parse |