Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

override _set_proxy_headers

This forces _set_proxy_headers in urllib3.poolmanager.ProxyManager to
not send "Accept: */*" through the proxy. A proxy like mitmproxy will
pass along this "Accept" header to the destination, which is not always
the desired result.
  • Loading branch information...
commit 3f89673139f128a9d7cd5b8b2d7512535b0b1527 1 parent fa1f9f4
@kanzure authored
Showing with 10 additions and 1 deletion.
  1. +9 −0 careful_requests/careful_requests.py
  2. +1 −1  setup.py
View
9 careful_requests/careful_requests.py
@@ -98,6 +98,15 @@ def connect(self):
requests.packages.urllib3.connectionpool.HTTPSConnection = CarefulHTTPSConnection
requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection = CarefulVerifiedHTTPSConnection
+def _set_proxy_headers(self, headers=None):
+ headers = headers or {}
+
+ # headers['Accept'] = '*/*'
+ # headers['Proxy-Connection'] = 'Keep-Alive'
+
+ return headers
+requests.packages.urllib3.poolmanager.ProxyManager._set_proxy_headers = _set_proxy_headers
+
class CarefulSession(requests.sessions.Session):
def __init__(self, *args, **kwargs):
config = {}
View
2  setup.py
@@ -3,7 +3,7 @@
setup(
name="careful-requests",
- version="0.1.3",
+ version="0.1.4",
url="https://github.com/kanzure/careful-requests",
license="BSD",
author="Bryan Bishop",
Please sign in to comment.
Something went wrong with that request. Please try again.