Permalink
Browse files

readme

  • Loading branch information...
1 parent 88a8d47 commit 116426cf46d1749321a343ffd9fb7e2f0acfe5a0 @gawel committed Dec 22, 2012
Showing with 82 additions and 9 deletions.
  1. +41 −0 README.rst
  2. +17 −0 README_fixt.py
  3. +0 −1 setup.cfg
  4. +21 −8 setup.py
  5. +3 −0 wsgi_proxy/__init__.py
View
41 README.rst
@@ -0,0 +1,41 @@
+==========
+wsgi_proxy
+==========
+
+Installation
+============
+
+With pip::
+
+ $ pip install wsgi_proxy
+
+Install optionnal backends::
+
+ $ pip install requests restkit urllib3
+
+
+Usage
+=====
+
+Create a proxy::
+
+ >>> from wsgi_proxy import HostProxy
+ >>> proxy = HostProxy(application_url)
+
+Then use it. Here is an example with WebOb but you can use it like a classic
+WSGI application::
+
+ >>> from webob import Request
+ >>> req = Request.blank('/form.html')
+ >>> resp = req.get_response(proxy)
+ >>> print(resp.text)
+ <html>...
+ ...</html>
+
+The Proxy application accept some keyword arguments. Those arguments are passed
+to requests during the process. By default ``allow_redirects`` and ``verify``
+are set to ``False`` but you can change the behavior::
+
+ >>> proxy = HostProxy(application_url, verify=True, allow_redirects=True,
+ ... max_redirects=10)
+
View
17 README_fixt.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+from doctest import ELLIPSIS
+from webtest.debugapp import debug_app
+from webtest.http import StopableWSGIServer
+
+
+def setup_test(test):
+ test.globs['server'] = StopableWSGIServer.create(debug_app)
+ test.globs['application_url'] = test.globs['server'].application_url
+ for example in test.examples:
+ example.options.setdefault(ELLIPSIS, 1)
+
+setup_test.__test__ = False
+
+
+def teardown_test(test):
+ test.globs['server'].shutdown()
View
1 setup.cfg
@@ -4,7 +4,6 @@ cover-package = wsgi_proxy
with-doctest = true
doctest-extension = rst
doctest-fixtures = _fixt
-verbosity = 3
[aliases]
release = register sdist upload
View
29 setup.py
@@ -2,18 +2,31 @@
version = '0.1'
+
+def read(name):
+ try:
+ with open(name) as fd:
+ return fd.read()
+ except:
+ return ''
+
setup(name='wsgi_proxy',
version=version,
- description="",
- long_description="""\
-""",
- classifiers=[],
- keywords='',
+ long_description=read('README.rst') + '\n' + read('CHANGES.rst'),
+ classifiers=[
+ 'License :: OSI Approved :: Apache Software License',
+ 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
+ ],
+ keywords='wsgi proxy',
author='Gael Pasgrimaud',
author_email='gael@gawel.org',
- url='',
- license='',
- packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
+ url='https://github.com/gawel/wsgi_proxy/',
+ license='MIT',
+ packages=find_packages(exclude=['ez_setup', 'README_fixt', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=['webob', 'six'],
View
3 wsgi_proxy/__init__.py
@@ -1 +1,4 @@
# -*- coding: utf-8 -*-
+from .proxies import Proxy # NOQA
+from .proxies import HostProxy # NOQA
+from .proxies import TransparentProxy # NOQA

0 comments on commit 116426c

Please sign in to comment.