Hello community,
here is the log from the commit of package python-wsgi_intercept for
openSUSE:Factory checked in at 2016-09-23 11:31:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-wsgi_intercept (Old)
and /work/SRC/openSUSE:Factory/.python-wsgi_intercept.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-wsgi_intercept"
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-wsgi_intercept/python-wsgi_intercept.changes
2016-02-03 10:19:50.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.python-wsgi_intercept.new/python-wsgi_intercept.changes
2016-09-23 11:31:11.000000000 +0200
@@ -1,0 +2,24 @@
+Fri Sep 2 07:28:41 UTC 2016 - [email protected]
+
+update to version v1.3.1
+ * Dedupe the urllib3 monkey patching code
+ * Fix for python3 in use of urllib3.Response.data
+ * add urllib3 to testing requires
+ * update readme
+ * Skip the network tests if WSGI_INTERCEPT_SKIP_NETWORK
+ * Release 1.2.1
+ * Force urllib3 to raise errors immediately
+ * Release 1.3.0
+ * Release 1.3.1
+ * Small fix in docstring
+ * Add urllib3 to the docs
+ * make urllib3 min requirement explicit
+ * Add support for intercepting urllib3
+ * Don't use six when testing httplib
+ * Release 1.2.0
+ * Ensure header values are native str
+ * fix typo in test/README
+ * Release 1.1.3
+- Use pypi.io (https) as Source url
+
+-------------------------------------------------------------------
Old:
----
wsgi_intercept-1.1.2.tar.gz
New:
----
wsgi_intercept-1.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-wsgi_intercept.spec ++++++
--- /var/tmp/diff_new_pack.rPQPqq/_old 2016-09-23 11:31:13.000000000 +0200
+++ /var/tmp/diff_new_pack.rPQPqq/_new 2016-09-23 11:31:13.000000000 +0200
@@ -17,13 +17,13 @@
Name: python-wsgi_intercept
-Version: 1.1.2
+Version: 1.3.1
Release: 0
Summary: Installs a WSGI application in place of a real URI for testing
License: MIT
Group: Development/Languages/Python
Url: https://github.com/cdent/python3-wsgi-intercept
-Source:
http://pypi.python.org/packages/source/w/wsgi_intercept/wsgi_intercept-%{version}.tar.gz
+Source:
https://pypi.io/packages/source/w/wsgi_intercept/wsgi_intercept-%{version}.tar.gz
# PATCH-FIX-OPENSUSE [email protected] -- Patching fails
Patch0: wsgi_intercept-disable-testbogusdomain.patch
BuildRequires: python-devel
@@ -32,6 +32,8 @@
BuildRequires: python-httplib2
BuildRequires: python-pytest >= 2.4
BuildRequires: python-requests >= 2.0.1
+BuildRequires: python-urllib3 >= 1.11.0
+Requires: python-six
Recommends: python-requests >= 2.0.1
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
++++++ wsgi_intercept-1.1.2.tar.gz -> wsgi_intercept-1.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/PKG-INFO
new/wsgi_intercept-1.3.1/PKG-INFO
--- old/wsgi_intercept-1.1.2/PKG-INFO 2016-01-27 10:16:53.000000000 +0100
+++ new/wsgi_intercept-1.3.1/PKG-INFO 2016-07-04 05:33:40.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: wsgi_intercept
-Version: 1.1.2
+Version: 1.3.1
Summary: wsgi_intercept installs a WSGI application in place of a real URI for
testing.
Home-page: http://pypi.python.org/pypi/wsgi_intercept
Author: Titus Brown, Kumar McMillan, Chris Dent, Sasha Hart
@@ -33,7 +33,7 @@
the subclass. For example::
import httplib2
- from wsgi_intercept.intercept import Httplib2Interceptor
+ from wsgi_intercept.interceptor import Httplib2Interceptor
from mywsgiapp import app
def load_app():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/README
new/wsgi_intercept-1.3.1/README
--- old/wsgi_intercept-1.1.2/README 2015-12-29 12:19:21.000000000 +0100
+++ new/wsgi_intercept-1.3.1/README 2016-09-23 11:31:13.000000000 +0200
@@ -1,42 +1 @@
-python3-wsgi-intercept
-======================
-
-[](https://secure.travis-ci.org/cdent/python3-wsgi-intercept)
-
-Python3 port of the important bits of wsgi-intercept, now working for
-2.7, 3.3, 3.4 and 3.5.
-
-Documentation is available on [Read The
-Docs](http://wsgi-intercept.readthedocs.org/en/latest/).
-
-What is it?
-===========
-
-wsgi_intercept installs a WSGI application in place of a real host for
-testing while still preserving HTTP semantics. See the
-[PyPI page](http://pypi.python.org/pypi/wsgi_intercept) page for more details.
-
-Modern Version
------------
-
-For the 2 and 3 version only some intercept functionality is provided,
-with a working implementation in Python 2 for:
-
-* `urllib2`
-* `httplib`
-* `httplib2`
-* `requests`
-
-and in Python 3 for:
-
-* `urllib.request`
-* `http.client`
-* `httplib2`
-* `requests`
-
-If you are using Python 2 and need support for a different HTTP
-client, require a version of `wsgi_intercept<0.6`. Another option
-to keep in mind is that interceptor code from earlier versions,
-such as the interceptor for `mechanize` ought to work when imported
-independently (see [related
-conversation](https://github.com/cdent/wsgi-intercept/issues/16)).
+symbolic link to README.md
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/docs/index.rst
new/wsgi_intercept-1.3.1/docs/index.rst
--- old/wsgi_intercept-1.1.2/docs/index.rst 2015-12-29 12:19:21.000000000
+0100
+++ new/wsgi_intercept-1.3.1/docs/index.rst 2016-07-04 05:27:44.000000000
+0200
@@ -15,6 +15,7 @@
http_client
httplib2
requests
+ urllib3
urllib
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/docs/urllib3.rst
new/wsgi_intercept-1.3.1/docs/urllib3.rst
--- old/wsgi_intercept-1.1.2/docs/urllib3.rst 1970-01-01 01:00:00.000000000
+0100
+++ new/wsgi_intercept-1.3.1/docs/urllib3.rst 2016-07-04 05:27:44.000000000
+0200
@@ -0,0 +1,32 @@
+urllib3_intercept
+==================
+
+.. automodule:: wsgi_intercept.urllib3_intercept
+
+
+Example:
+
+.. testcode::
+
+ import urllib3
+ from wsgi_intercept import urllib3_intercept, add_wsgi_intercept
+
+ pool = urllib3.PoolManager()
+
+
+ def app(environ, start_response):
+ start_response('200 OK', [('Content-Type', 'text/plain')])
+ return [b'Whee']
+
+
+ def make_app():
+ return app
+
+
+ host, port = 'localhost', 80
+ url = 'http://{0}:{1}/'.format(host, port)
+ urllib3_intercept.install()
+ add_wsgi_intercept(host, port, make_app)
+ resp = pool.requests('GET', url)
+ assert resp.data == b'Whee'
+ urllib3_intercept.uninstall()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/setup.py
new/wsgi_intercept-1.3.1/setup.py
--- old/wsgi_intercept-1.1.2/setup.py 2015-12-29 12:19:21.000000000 +0100
+++ new/wsgi_intercept-1.3.1/setup.py 2016-07-04 05:27:44.000000000 +0200
@@ -38,6 +38,7 @@
'pytest>=2.4',
'httplib2',
'requests>=2.0.1',
+ 'urllib3>=1.11.0',
],
},
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/README
new/wsgi_intercept-1.3.1/test/README
--- old/wsgi_intercept-1.1.2/test/README 1970-01-01 01:00:00.000000000
+0100
+++ new/wsgi_intercept-1.3.1/test/README 2016-07-04 05:27:44.000000000
+0200
@@ -0,0 +1,6 @@
+
+If you wish to run the tests without those tests which speak to
+the internet (there are a few that validate that the intercept
+does not intercept), set the WSGI_INTERCEPT_SKIP_NETWORK environment
+variable to "True". Any other value or no value will mean that
+the network tests will run.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/install.py
new/wsgi_intercept-1.3.1/test/install.py
--- old/wsgi_intercept-1.1.2/test/install.py 2016-01-22 15:33:47.000000000
+0100
+++ new/wsgi_intercept-1.3.1/test/install.py 2016-07-04 05:27:44.000000000
+0200
@@ -1,7 +1,14 @@
import os
+import pytest
import wsgi_intercept
+skipnetwork = pytest.mark.skipif(os.environ.get(
+ 'WSGI_INTERCEPT_SKIP_NETWORK', 'False').lower() == 'true',
+ reason="skip network requested"
+)
+
+
class BaseInstalledApp(object):
def __init__(self, app, host, port=80, script_name='',
install=None, uninstall=None, proxy=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/test_http_client.py
new/wsgi_intercept-1.3.1/test/test_http_client.py
--- old/wsgi_intercept-1.1.2/test/test_http_client.py 2016-01-22
15:37:28.000000000 +0100
+++ new/wsgi_intercept-1.3.1/test/test_http_client.py 2016-07-04
05:27:44.000000000 +0200
@@ -1,7 +1,7 @@
import py.test
from wsgi_intercept import http_client_intercept, WSGIAppError
from test import wsgi_app
-from test.install import installer_class
+from test.install import installer_class, skipnetwork
try:
import http.client as http_lib
except ImportError:
@@ -63,6 +63,7 @@
http_client.close()
+@skipnetwork
def test_http_not_intercepted():
with InstalledApp(wsgi_app.raises_app, host=HOST, port=80):
http_client = http_lib.HTTPConnection('google.com')
@@ -72,6 +73,7 @@
assert 200 <= int(response.status) < 400
+@skipnetwork
def test_https_not_intercepted():
with InstalledApp(wsgi_app.raises_app, host=HOST, port=443):
http_client = http_lib.HTTPSConnection('google.com')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/test_interceptor.py
new/wsgi_intercept-1.3.1/test/test_interceptor.py
--- old/wsgi_intercept-1.1.2/test/test_interceptor.py 2015-12-29
12:19:21.000000000 +0100
+++ new/wsgi_intercept-1.3.1/test/test_interceptor.py 2016-07-04
05:27:44.000000000 +0200
@@ -9,16 +9,22 @@
import py.test
import requests
+import urllib3
from httplib2 import Http, ServerNotFoundError
-from six.moves import http_client
+# don't use six as the monkey patching gets confused
+try:
+ import http.client as http_client
+except ImportError:
+ import httplib as http_client
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError
from wsgi_intercept.interceptor import (
Interceptor, HttpClientInterceptor, Httplib2Interceptor,
- RequestsInterceptor, UrllibInterceptor)
+ RequestsInterceptor, UrllibInterceptor, Urllib3Interceptor)
from .wsgi_app import simple_app
+httppool = urllib3.PoolManager()
def app():
return simple_app
@@ -178,6 +184,41 @@
requests.get(url)
+# urllib3
+
+def test_urllib3_interceptor_host():
+ hostname = str(uuid4())
+ port = 9999
+ with Urllib3Interceptor(app=app, host=hostname, port=port) as url:
+ response = httppool.request('GET', url)
+ assert response.status == 200
+ assert 'WSGI intercept successful!' in str(response.data)
+
+
+def test_urllib3_interceptor_url():
+ hostname = str(uuid4())
+ port = 9999
+ url = 'http://%s:%s/' % (hostname, port)
+ with Urllib3Interceptor(app=app, url=url) as target_url:
+ response = httppool.request('GET', target_url)
+ assert response.status == 200
+ assert 'WSGI intercept successful!' in str(response.data)
+
+
+def test_urllib3_in_out():
+ hostname = str(uuid4())
+ port = 9999
+ url = 'http://%s:%s/' % (hostname, port)
+ with Urllib3Interceptor(app=app, url=url) as target_url:
+ response = httppool.request('GET', target_url)
+ assert response.status == 200
+ assert 'WSGI intercept successful!' in str(response.data)
+
+ # outside the context manager the intercept does not work
+ with py.test.raises(urllib3.exceptions.ProtocolError):
+ httppool.request('GET', url, retries=False)
+
+
# urllib
def test_urllib_interceptor_host():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/test_requests.py
new/wsgi_intercept-1.3.1/test/test_requests.py
--- old/wsgi_intercept-1.1.2/test/test_requests.py 2016-01-22
15:33:47.000000000 +0100
+++ new/wsgi_intercept-1.3.1/test/test_requests.py 2016-07-04
05:27:44.000000000 +0200
@@ -2,7 +2,7 @@
import py.test
from wsgi_intercept import requests_intercept, WSGIAppError
from test import wsgi_app
-from test.install import installer_class
+from test.install import installer_class, skipnetwork
import requests
from requests.exceptions import ConnectionError
@@ -75,12 +75,14 @@
requests.get('http://some_hopefully_nonexistant_domain/')
+@skipnetwork
def test_http_not_intercepted():
with InstalledApp(wsgi_app.raises_app, host=HOST, port=80):
resp = requests.get("http://google.com")
assert resp.status_code >= 200 and resp.status_code < 300
+@skipnetwork
def test_https_not_intercepted():
with InstalledApp(wsgi_app.raises_app, host=HOST, port=80):
resp = requests.get("https://google.com")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/test_urllib.py
new/wsgi_intercept-1.3.1/test/test_urllib.py
--- old/wsgi_intercept-1.1.2/test/test_urllib.py 2016-01-22
15:38:35.000000000 +0100
+++ new/wsgi_intercept-1.3.1/test/test_urllib.py 2016-07-04
05:27:44.000000000 +0200
@@ -2,7 +2,7 @@
import py.test
from wsgi_intercept import urllib_intercept, WSGIAppError
from test import wsgi_app
-from test.install import installer_class
+from test.install import installer_class, skipnetwork
try:
import urllib.request as url_lib
except ImportError:
@@ -66,12 +66,14 @@
url_lib.urlopen('http://some_hopefully_nonexistant_domain/')
+@skipnetwork
def test_http_not_intercepted():
with InstalledApp(wsgi_app.simple_app, host=HOST, port=80):
response = url_lib.urlopen('http://google.com/')
assert 200 <= int(response.code) < 400
+@skipnetwork
def test_https_not_intercepted():
with InstalledApp(wsgi_app.simple_app, host=HOST, port=443):
response = url_lib.urlopen('https://google.com/')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/test_urllib3.py
new/wsgi_intercept-1.3.1/test/test_urllib3.py
--- old/wsgi_intercept-1.1.2/test/test_urllib3.py 1970-01-01
01:00:00.000000000 +0100
+++ new/wsgi_intercept-1.3.1/test/test_urllib3.py 2016-07-04
05:27:44.000000000 +0200
@@ -0,0 +1,90 @@
+import os
+import py.test
+import socket
+from wsgi_intercept import urllib3_intercept, WSGIAppError
+from test import wsgi_app
+from test.install import installer_class, skipnetwork
+import urllib3
+
+HOST = 'some_hopefully_nonexistant_domain'
+
+InstalledApp = installer_class(urllib3_intercept)
+http = urllib3.PoolManager()
+
+
+def test_http():
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=80) as app:
+ resp = http.request('GET',
'http://some_hopefully_nonexistant_domain:80/')
+ assert resp.data == b'WSGI intercept successful!\n'
+ assert app.success()
+
+
+def test_http_default_port():
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=80) as app:
+ resp = http.request('GET', 'http://some_hopefully_nonexistant_domain/')
+ assert resp.data == b'WSGI intercept successful!\n'
+ assert app.success()
+
+
+def test_http_other_port():
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=8080) as app:
+ resp = http.request('GET',
'http://some_hopefully_nonexistant_domain:8080/')
+ assert resp.data == b'WSGI intercept successful!\n'
+ assert app.success()
+ environ = app.get_internals()
+ assert environ['wsgi.url_scheme'] == 'http'
+
+
+def test_bogus_domain():
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=80):
+ py.test.raises(
+ urllib3.exceptions.ProtocolError,
+ 'http.request("GET", "http://_nonexistant_domain_",
retries=False)')
+
+
+def test_proxy_handling():
+ with py.test.raises(RuntimeError) as exc:
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=80,
+ proxy='some_proxy.com:1234'):
+ http.request('GET', 'http://some_hopefully_nonexistant_domain:80/')
+ assert 'http_proxy or https_proxy set in environment' in str(exc.value)
+ # We need to do this by hand because the exception was raised
+ # during the entry of the context manager, so the exit handler
+ # wasn't reached.
+ del os.environ['http_proxy']
+
+
+def test_https():
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=443) as app:
+ resp = http.request('GET',
'https://some_hopefully_nonexistant_domain:443/')
+ assert resp.data == b'WSGI intercept successful!\n'
+ assert app.success()
+
+
+def test_https_default_port():
+ with InstalledApp(wsgi_app.simple_app, host=HOST, port=443) as app:
+ resp = http.request('GET',
'https://some_hopefully_nonexistant_domain/')
+ assert resp.data == b'WSGI intercept successful!\n'
+ assert app.success()
+ environ = app.get_internals()
+ assert environ['wsgi.url_scheme'] == 'https'
+
+
+def test_app_error():
+ with InstalledApp(wsgi_app.raises_app, host=HOST, port=80):
+ with py.test.raises(WSGIAppError):
+ http.request('GET', 'http://some_hopefully_nonexistant_domain/')
+
+
+@skipnetwork
+def test_http_not_intercepted():
+ with InstalledApp(wsgi_app.raises_app, host=HOST, port=80):
+ resp = http.request('GET', 'http://google.com')
+ assert resp.status >= 200 and resp.status < 300
+
+
+@skipnetwork
+def test_https_not_intercepted():
+ with InstalledApp(wsgi_app.raises_app, host=HOST, port=80):
+ resp = http.request('GET', 'https://google.com')
+ assert resp.status >= 200 and resp.status < 300
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/test/test_wsgi_compliance.py
new/wsgi_intercept-1.3.1/test/test_wsgi_compliance.py
--- old/wsgi_intercept-1.1.2/test/test_wsgi_compliance.py 2016-01-22
15:36:42.000000000 +0100
+++ new/wsgi_intercept-1.3.1/test/test_wsgi_compliance.py 2016-07-04
05:27:44.000000000 +0200
@@ -50,7 +50,8 @@
resp, content = http.request(
'http://some_hopefully_nonexistant_domain' + expected_uri,
'GET',
- headers={'Accept': 'application/json'})
+ headers={'Accept': 'application/json',
+ 'Cookie': 'foo=bar'})
internal_env = app.get_internals()
expected_path_info = unquote(expected_uri.split('?')[0])
@@ -58,6 +59,8 @@
assert internal_env['RAW_URI'] == expected_uri
assert internal_env['QUERY_STRING'] == 'bar=baz%20zoom'
assert internal_env['HTTP_ACCEPT'] == 'application/json'
+ assert internal_env['HTTP_COOKIE'] == 'foo=bar'
+ assert type(internal_env['HTTP_COOKIE']) == type('')
# Do the rather painful wsgi encoding dance.
if sys.version_info[0] > 2:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/wsgi_intercept/__init__.py
new/wsgi_intercept-1.3.1/wsgi_intercept/__init__.py
--- old/wsgi_intercept-1.1.2/wsgi_intercept/__init__.py 2016-01-27
10:10:04.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept/__init__.py 2016-07-04
05:27:44.000000000 +0200
@@ -26,7 +26,7 @@
the subclass. For example::
import httplib2
- from wsgi_intercept.intercept import Httplib2Interceptor
+ from wsgi_intercept.interceptor import Httplib2Interceptor
from mywsgiapp import app
def load_app():
@@ -120,7 +120,7 @@
"""
from __future__ import print_function
-__version__ = '1.1.2'
+__version__ = '1.3.1'
import sys
@@ -220,7 +220,11 @@
k, v = line.strip().split(b':', 1)
v = v.lstrip()
- v = v.decode('ISO-8859-1')
+ # Make header value a "native" string. PEP 3333 requires that
+ # string-like things in headers be of type `str`. Much of the
+ # time this isn't a problem but the SimpleCookie library does
+ # type checking against `type("")`.
+ v = str(v.decode('ISO-8859-1'))
#
# take care of special headers, and for the rest, put them
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/wsgi_intercept/_urllib3.py
new/wsgi_intercept-1.3.1/wsgi_intercept/_urllib3.py
--- old/wsgi_intercept-1.1.2/wsgi_intercept/_urllib3.py 1970-01-01
01:00:00.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept/_urllib3.py 2016-07-04
05:27:44.000000000 +0200
@@ -0,0 +1,45 @@
+"""Common code of urllib3 and requests intercepts."""
+
+import os
+import sys
+
+from . import WSGI_HTTPConnection, WSGI_HTTPSConnection, wsgi_fake_socket
+
+
+wsgi_fake_socket.settimeout = lambda self, timeout: None
+
+
+def make_urllib3_override(HTTPConnectionPool, HTTPSConnectionPool,
+ HTTPConnection, HTTPSConnection):
+
+ class HTTP_WSGIInterceptor(WSGI_HTTPConnection, HTTPConnection):
+ def __init__(self, *args, **kwargs):
+ if 'strict' in kwargs and sys.version_info > (3, 0):
+ kwargs.pop('strict')
+ WSGI_HTTPConnection.__init__(self, *args, **kwargs)
+ HTTPConnection.__init__(self, *args, **kwargs)
+
+
+ class HTTPS_WSGIInterceptor(WSGI_HTTPSConnection, HTTPSConnection):
+ is_verified = True
+
+ def __init__(self, *args, **kwargs):
+ if 'strict' in kwargs and sys.version_info > (3, 0):
+ kwargs.pop('strict')
+ WSGI_HTTPSConnection.__init__(self, *args, **kwargs)
+ HTTPSConnection.__init__(self, *args, **kwargs)
+
+
+ def install():
+ if 'http_proxy' in os.environ or 'https_proxy' in os.environ:
+ raise RuntimeError(
+ 'http_proxy or https_proxy set in environment, please unset')
+ HTTPConnectionPool.ConnectionCls = HTTP_WSGIInterceptor
+ HTTPSConnectionPool.ConnectionCls = HTTPS_WSGIInterceptor
+
+
+ def uninstall():
+ HTTPConnectionPool.ConnectionCls = HTTPConnection
+ HTTPSConnectionPool.ConnectionCls = HTTPSConnection
+
+ return install, uninstall
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/wsgi_intercept-1.1.2/wsgi_intercept/http_client_intercept.py
new/wsgi_intercept-1.3.1/wsgi_intercept/http_client_intercept.py
--- old/wsgi_intercept-1.1.2/wsgi_intercept/http_client_intercept.py
2015-12-28 13:23:56.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept/http_client_intercept.py
2016-07-04 05:27:44.000000000 +0200
@@ -19,16 +19,13 @@
HTTPSConnection as OriginalHTTPSConnection
)
-HTTPInterceptorMixin = WSGI_HTTPConnection
-HTTPSInterceptorMixin = WSGI_HTTPSConnection
-
-class HTTP_WSGIInterceptor(HTTPInterceptorMixin, http_lib.HTTPConnection):
+class HTTP_WSGIInterceptor(WSGI_HTTPConnection, http_lib.HTTPConnection):
pass
-class HTTPS_WSGIInterceptor(HTTPSInterceptorMixin, http_lib.HTTPSConnection,
- HTTP_WSGIInterceptor):
+class HTTPS_WSGIInterceptor(WSGI_HTTPSConnection, http_lib.HTTPSConnection,
+ HTTP_WSGIInterceptor):
def __init__(self, host, **kwargs):
self.host = host
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/wsgi_intercept-1.1.2/wsgi_intercept/interceptor.py
new/wsgi_intercept-1.3.1/wsgi_intercept/interceptor.py
--- old/wsgi_intercept-1.1.2/wsgi_intercept/interceptor.py 2015-12-29
12:19:21.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept/interceptor.py 2016-07-04
05:27:44.000000000 +0200
@@ -109,6 +109,12 @@
MODULE_NAME = 'requests_intercept'
+class Urllib3Interceptor(Interceptor):
+ """Interceptor for requests."""
+
+ MODULE_NAME = 'urllib3_intercept'
+
+
class UrllibInterceptor(Interceptor):
"""Interceptor for urllib2 and urllib.request."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/wsgi_intercept-1.1.2/wsgi_intercept/requests_intercept.py
new/wsgi_intercept-1.3.1/wsgi_intercept/requests_intercept.py
--- old/wsgi_intercept-1.1.2/wsgi_intercept/requests_intercept.py
2016-01-22 15:40:33.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept/requests_intercept.py
2016-07-04 05:27:44.000000000 +0200
@@ -2,45 +2,14 @@
`requests <http://docs.python-requests.org/en/latest/>`_.
"""
-import os
-import sys
-
-from . import WSGI_HTTPConnection, WSGI_HTTPSConnection, wsgi_fake_socket
from requests.packages.urllib3.connectionpool import (HTTPConnectionPool,
HTTPSConnectionPool)
from requests.packages.urllib3.connection import (HTTPConnection,
HTTPSConnection)
+from ._urllib3 import make_urllib3_override
-wsgi_fake_socket.settimeout = lambda self, timeout: None
-
-
-class HTTP_WSGIInterceptor(WSGI_HTTPConnection, HTTPConnection):
- def __init__(self, *args, **kwargs):
- if 'strict' in kwargs and sys.version_info > (3, 0):
- kwargs.pop('strict')
- WSGI_HTTPConnection.__init__(self, *args, **kwargs)
- HTTPConnection.__init__(self, *args, **kwargs)
-
-
-class HTTPS_WSGIInterceptor(WSGI_HTTPSConnection, HTTPSConnection):
- is_verified = True
-
- def __init__(self, *args, **kwargs):
- if 'strict' in kwargs and sys.version_info > (3, 0):
- kwargs.pop('strict')
- WSGI_HTTPSConnection.__init__(self, *args, **kwargs)
- HTTPSConnection.__init__(self, *args, **kwargs)
-
-
-def install():
- if 'http_proxy' in os.environ or 'https_proxy' in os.environ:
- raise RuntimeError(
- 'http_proxy or https_proxy set in environment, please unset')
- HTTPConnectionPool.ConnectionCls = HTTP_WSGIInterceptor
- HTTPSConnectionPool.ConnectionCls = HTTPS_WSGIInterceptor
-
-
-def uninstall():
- HTTPConnectionPool.ConnectionCls = HTTPConnection
- HTTPSConnectionPool.ConnectionCls = HTTPSConnection
+install, uninstall = make_urllib3_override(HTTPConnectionPool,
+ HTTPSConnectionPool,
+ HTTPConnection,
+ HTTPSConnection)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/wsgi_intercept-1.1.2/wsgi_intercept/urllib3_intercept.py
new/wsgi_intercept-1.3.1/wsgi_intercept/urllib3_intercept.py
--- old/wsgi_intercept-1.1.2/wsgi_intercept/urllib3_intercept.py
1970-01-01 01:00:00.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept/urllib3_intercept.py
2016-07-04 05:27:44.000000000 +0200
@@ -0,0 +1,13 @@
+"""Intercept HTTP connections that use
+`urllib3 <https://urllib3.readthedocs.org/>`_.
+"""
+
+from urllib3.connectionpool import HTTPConnectionPool, HTTPSConnectionPool
+from urllib3.connection import HTTPConnection, HTTPSConnection
+from ._urllib3 import make_urllib3_override
+
+
+install, uninstall = make_urllib3_override(HTTPConnectionPool,
+ HTTPSConnectionPool,
+ HTTPConnection,
+ HTTPSConnection)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/wsgi_intercept-1.1.2/wsgi_intercept.egg-info/PKG-INFO
new/wsgi_intercept-1.3.1/wsgi_intercept.egg-info/PKG-INFO
--- old/wsgi_intercept-1.1.2/wsgi_intercept.egg-info/PKG-INFO 2016-01-27
10:16:53.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept.egg-info/PKG-INFO 2016-07-04
05:33:40.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: wsgi-intercept
-Version: 1.1.2
+Version: 1.3.1
Summary: wsgi_intercept installs a WSGI application in place of a real URI for
testing.
Home-page: http://pypi.python.org/pypi/wsgi_intercept
Author: Titus Brown, Kumar McMillan, Chris Dent, Sasha Hart
@@ -33,7 +33,7 @@
the subclass. For example::
import httplib2
- from wsgi_intercept.intercept import Httplib2Interceptor
+ from wsgi_intercept.interceptor import Httplib2Interceptor
from mywsgiapp import app
def load_app():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/wsgi_intercept-1.1.2/wsgi_intercept.egg-info/SOURCES.txt
new/wsgi_intercept-1.3.1/wsgi_intercept.egg-info/SOURCES.txt
--- old/wsgi_intercept-1.1.2/wsgi_intercept.egg-info/SOURCES.txt
2016-01-27 10:16:53.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept.egg-info/SOURCES.txt
2016-07-04 05:33:40.000000000 +0200
@@ -13,8 +13,10 @@
docs/interceptor.rst
docs/requests.rst
docs/urllib.rst
+docs/urllib3.rst
docs/_static/.gitignore
docs/_templates/.gitignore
+test/README
test/__init__.py
test/install.py
test/test_http_client.py
@@ -23,13 +25,16 @@
test/test_module_interceptor.py
test/test_requests.py
test/test_urllib.py
+test/test_urllib3.py
test/test_wsgi_compliance.py
test/wsgi_app.py
wsgi_intercept/__init__.py
+wsgi_intercept/_urllib3.py
wsgi_intercept/http_client_intercept.py
wsgi_intercept/httplib2_intercept.py
wsgi_intercept/interceptor.py
wsgi_intercept/requests_intercept.py
+wsgi_intercept/urllib3_intercept.py
wsgi_intercept/urllib_intercept.py
wsgi_intercept.egg-info/PKG-INFO
wsgi_intercept.egg-info/SOURCES.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/wsgi_intercept-1.1.2/wsgi_intercept.egg-info/requires.txt
new/wsgi_intercept-1.3.1/wsgi_intercept.egg-info/requires.txt
--- old/wsgi_intercept-1.1.2/wsgi_intercept.egg-info/requires.txt
2016-01-27 10:16:53.000000000 +0100
+++ new/wsgi_intercept-1.3.1/wsgi_intercept.egg-info/requires.txt
2016-07-04 05:33:40.000000000 +0200
@@ -4,3 +4,4 @@
pytest>=2.4
httplib2
requests>=2.0.1
+urllib3>=1.11.0