diff --git a/README.md b/README.md index 69e58c85..7e688f4b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,41 @@ proxy.py ======== -HTTP Proxy Server in Python. +Lightweight HTTP Proxy Server in Python. + +Features +-------- + +- Distributed as a single file module +- No dependency other than the Python standard library +- Support for http, https, websockets request proxy + +Install +------- + +To install proxy.py, simply: + + $ pip install proxy.py + +This will add `proxy.py` inside your python bin folder. + +Usage +----- + +``` +$ proxy.py -h +usage: proxy.py [-h] [--hostname HOSTNAME] [--port PORT] + [--log-level LOG_LEVEL] + +proxy.py v0.1 + +optional arguments: + -h, --help show this help message and exit + --hostname HOSTNAME Default: 127.0.0.1 + --port PORT Default: 8899 + --log-level LOG_LEVEL + DEBUG, INFO, WARNING, ERROR, CRITICAL + +Having difficulty using proxy.py? Report at: +https://github.com/abhinavsingh/proxy.py/issues/new +``` diff --git a/proxy.py b/proxy.py index 3a3a2cb6..a40d3e81 100644 --- a/proxy.py +++ b/proxy.py @@ -25,7 +25,7 @@ import logging import socket import select -logger = logging.getLogger('proxy.py') +logger = logging.getLogger(__name__) CRLF, COLON, SP = '\r\n', ':', ' ' @@ -103,7 +103,8 @@ class HttpParser(object): self.buffer = '' more = True if len(data) > 0 else False - while more: more, data = self.process(data) + while more: + more, data = self.process(data) self.buffer = data def process(self, data): @@ -209,7 +210,7 @@ class HttpParser(object): return line, data class Connection(object): - """TCP connection abstraction""" + """TCP connection abstraction.""" def __init__(self, what): self.buffer = ''