A WSGI Proxy with various http client backends
$ pip install WSGIProxy2
Install optionnal backends:
$ pip install requests urllib3
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.
>>> proxy = HostProxy(application_url, client='urllib3')
Use requests. This client support response streaming:
>>> proxy = HostProxy(application_url, client='requests')
- remove stale dep on six
- use github actions as CI
- Drop support for python3.6 and bellow
- PATCH added into (default) list of allowed methods
- Allow to use URIs with no path
- Clean up connection before returning result. This removes some ResourceWarnings when testing
- Add OPTIONS to defaults allowed methods
- Drop restkit support
- Drop py26 support
- Undo webob’s unquoting to handle paths with percent quoted utf8 characters [Laurence Rowe]
- Include README_fixt.py in release
- fix tests.
- change the way requests iter response
Make allowed_methods check optional
Return the data not gzip decoded when using request
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for WSGIProxy2-0.5.1-py3-none-any.whl