Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gawel/requests_proxy
https://github.com/gawel/requests_proxy
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gawel/requests_proxy
- Owner: gawel
- License: other
- Created: 2012-12-17T21:24:38.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-18T00:02:28.000Z (about 12 years ago)
- Last Synced: 2024-12-12T09:06:45.398Z (10 days ago)
- Language: Python
- Size: 110 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE
Awesome Lists containing this project
README
==============
requests_proxy
==============A WSGI Proxy using `requests `_.
Installation
============With pip::
$ pip install requests_proxy
Usage
=====Create a proxy::
>>> from requests_proxy import Proxy
>>> proxy = Proxy(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)
...
...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 = Proxy(application_url, verify=True, allow_redirects=True,
... max_redirects=10)Warning
=======This proxy does not totally respect the RFC. Chunked Transfer-Encoding in
request headers are not supported. Also if you plan to upload some large file,
the proxy is not able to stream the content. (Mostly because requests is not
able to stream requests' body)If you need a more robust WSGI proxy, have a look at
`restkit.contrib.wsgi_proxy
`_