Skip to main content

A WSGI Proxy with various http client backends

Project description

Installation

With pip:

$ pip install WSGIProxy2

Install optionnal backends:

$ pip install requests restkit urllib3

Usage

Create a proxy:

>>> from wsgiproxy 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 the client during the process.

If no client as specified then python httplib is used. It’s recommended to use a more robust client able to manage a connection pool and stuff.

Use urllib3:

>>> proxy = HostProxy(application_url, client='urllib3')

Use requests. This client support response streaming:

>>> proxy = HostProxy(application_url, client='requests')

Use restkit. This client support request and response streaming but does not support python3 (will be fixed with the next release):

>>> proxy = HostProxy(application_url, client='restkit') # doctest: +SKIP

Changes

0.4.6 (2019-02-22)

  • PATCH added into (default) list of allowed methods

0.4.5 (2018-09-19)

  • Allow to use URIs with no path

0.4.4 (2017-06-02)

  • Clean up connection before returning result. This removes some ResourceWarnings when testing

0.4.3 (2017-02-17)

  • Add OPTIONS to defaults allowed methods

  • Drop restkit support

  • Drop py26 support

0.4.2 (2014-12-20)

  • Undo webob’s unquoting to handle paths with percent quoted utf8 characters [Laurence Rowe]

0.4.1 (2013-12-21)

  • Include README_fixt.py in release

0.4 (2013-12-21)

  • fix tests.

  • change the way requests iter response

0.3 (2013-09-12)

Make allowed_methods check optional

0.2

Return the data not gzip decoded when using request

0.1

Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WSGIProxy2-0.4.6.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

WSGIProxy2-0.4.6-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file WSGIProxy2-0.4.6.tar.gz.

File metadata

  • Download URL: WSGIProxy2-0.4.6.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for WSGIProxy2-0.4.6.tar.gz
Algorithm Hash digest
SHA256 cee2a64abc193cc96c7ff1208b709335e9a4d1316ce84b91501102166d814c9a
MD5 cf4f45bed6ab74ad644bee58bcad4e83
BLAKE2b-256 9edb3e8d6877cc12de58ff67eecfab58acc50b2e2803381a06e21c78fa99713c

See more details on using hashes here.

Provenance

File details

Details for the file WSGIProxy2-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: WSGIProxy2-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for WSGIProxy2-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6d94ff1b1142a5544571912a6745bdb654a854d1ee96a48f0656b1cb254ccb9f
MD5 118a1b91e1b0e1bd4bc9a1cdfd8d17b8
BLAKE2b-256 2da53afac2542081b890de83e0089a0057cfb7dc9ad877ccc5594e6c6e1976b8

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page