Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Commenting added. Automodule not yet working
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlaLlama committed Feb 8, 2016
1 parent 5e04629 commit 3911edf
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 2 deletions.
18 changes: 18 additions & 0 deletions docs/http-proxy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
vumi-http-proxy Package
================

:mod: `vumi-http-proxy` Package
--------------------

.. automodule:: vumi-http-proxy.__init__
:members:
:undoc-members:
:show-inheritance:

:mod: `http_proxy` Module
---------------------------

.. automodule:: vumi-http-proxy.http_proxy
:members:
:undoc-members:
:show-inheritance:
5 changes: 4 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ Contents:
=================

.. toctree::
:maxdepth: 3
:maxdepth: 2

project-outline.rst
usage.rst
queen-of-ni.rst
http-proxy.rst

.. automodule:: vumi-http-proxy.http_proxy
:members:


Indices and tables
Expand Down
6 changes: 5 additions & 1 deletion docs/queen-of-ni.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ Otherwise to use manual configuration, run::

For help, see::

(ve)$ queen-of-ni --help
(ve)$ queen-of-ni --help

.. warning::

This version does not yet support HTTPS requests
4 changes: 4 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ To run using manual configuration::
For hints and a list of all available commands, please see::
(ve)$ twistd -n vumi_http_proxy --help

.. warning::

This version does not yet support HTTPS requests
8 changes: 8 additions & 0 deletions vumi_http_proxy/config_reader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""Reader class for specified .yml configuration file
proxy-blacklist: [list of ip addresses to blacklist]
dns-servers: [list of manual dns servers to use]
.. moduleauthor:: Carla Wilby <thisiscarlawilby@gmail.com>
"""

import yaml
from twisted.python import log

Expand Down
18 changes: 18 additions & 0 deletions vumi_http_proxy/http_proxy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""Proxy generator to resolve and check client HTTP requests
.. moduleauthor:: Carla Wilby <thisiscarlawilby@gmail.com>
"""

from twisted.python import log
from twisted.web import http, proxy
from twisted.internet import reactor
Expand Down Expand Up @@ -99,13 +105,25 @@ def __init__(self, blacklist, resolver, http_client):


class Initialize(object):
"""This class initialises the proxy based on the configuration specified
"""
def __init__(self, blacklist, dnsservers, ip, port):
""" :param blacklist: List of disallowed ip addresses.
:type blacklist: list
:param dnservers: List of manual dns servers to use.
:type dnsservers: list
:param ip: Address of server to initialize proxy
:type ip: str
:param port: Port of server to initialize proxy
:type port: int
"""
self.blacklist = blacklist
self.dnsservers = dnsservers
self.ip = ip
self.port = port

def main(self):

resolver = client.createResolver(self.dnsservers)
http_client = Agent(reactor)
factory = ProxyFactory(self.blacklist, resolver, http_client)
Expand Down
9 changes: 9 additions & 0 deletions vumi_http_proxy/queen_of_ni.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/usr/bin/env python

"""Click command line interface to launch vumi-http-proxy
Specify: interface: default 0.0.0.0
port: default 8080
configfile: default None
.. moduleauthor:: Carla Wilby <thisiscarlawilby@gmail.com>
"""

import click
from vumi_http_proxy import http_proxy
from vumi_http_proxy import config_reader
Expand Down
9 changes: 9 additions & 0 deletions vumi_http_proxy/servicemaker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/usr/bin/env python

"""Twistd plugin to launch vumi-http-proxy
Specify: interface: default 0.0.0.0
port: default 8080
configfile: default None
.. moduleauthor:: Carla Wilby <thisiscarlawilby@gmail.com>
"""

from zope.interface import implements

from twisted.python import usage
Expand Down

0 comments on commit 3911edf

Please sign in to comment.