Hello community, here is the log from the commit of package python3-requests for openSUSE:Factory checked in at 2015-03-16 07:01:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-requests (Old) and /work/SRC/openSUSE:Factory/.python3-requests.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-requests" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-requests/python3-requests.changes 2015-02-27 11:00:29.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python3-requests.new/python3-requests.changes 2015-03-16 07:01:19.000000000 +0100 @@ -1,0 +2,23 @@ +Sat Mar 14 20:33:35 UTC 2015 - a...@gmx.de + +- update to version 2.6.0: + * Fix handling of cookies on redirect. Previously a cookie without a + host value set would use the hostname for the redirected URL + exposing requests users to session fixation attacks and + potentially cookie stealing. This was disclosed privately by + Matthew Daley of BugFuzz. An CVE identifier has not yet been + assigned for this. This affects all versions of requests from + v2.1.0 to v2.5.3 (inclusive on both ends). + * Fix error when requests is an install_requires dependency and + python setup.py test is run. (#2462) + * Fix error when urllib3 is unbundled and requests continues to use + the vendored import location. + * Include fixes to urllib3‘s header handling. + * Requests’ handling of unvendored dependencies is now more + restrictive. + * Support bytearrays when passed as parameters in the files + argument. (#2468) + * Avoid data duplication when creating a request with str, bytes, or + bytearray input to the files argument. + +------------------------------------------------------------------- Old: ---- requests-2.5.3.tar.gz New: ---- requests-2.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-requests.spec ++++++ --- /var/tmp/diff_new_pack.Dt7OcI/_old 2015-03-16 07:01:20.000000000 +0100 +++ /var/tmp/diff_new_pack.Dt7OcI/_new 2015-03-16 07:01:20.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-requests -Version: 2.5.3 +Version: 2.6.0 Release: 0 Url: http://python-requests.org Summary: Awesome Python HTTP Library That's Actually Usable ++++++ requests-2.5.3.tar.gz -> requests-2.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/HISTORY.rst new/requests-2.6.0/HISTORY.rst --- old/requests-2.5.3/HISTORY.rst 2015-02-24 17:33:01.000000000 +0100 +++ new/requests-2.6.0/HISTORY.rst 2015-03-14 17:43:47.000000000 +0100 @@ -3,6 +3,36 @@ Release History --------------- +2.6.0 (2015-03-14) +++++++++++++++++++ + +**Bugfixes** + +- Fix handling of cookies on redirect. Previously a cookie without a host + value set would use the hostname for the redirected URL exposing requests + users to session fixation attacks and potentially cookie stealing. This was + disclosed privately by Matthew Daley of `BugFuzz <https://bugfuzz.com>`_. + An CVE identifier has not yet been assigned for this. This affects all + versions of requests from v2.1.0 to v2.5.3 (inclusive on both ends). + +- Fix error when requests is an ``install_requires`` dependency and ``python + setup.py test`` is run. (#2462) + +- Fix error when urllib3 is unbundled and requests continues to use the + vendored import location. + +- Include fixes to ``urllib3``'s header handling. + +- Requests' handling of unvendored dependencies is now more restrictive. + +**Features and Improvements** + +- Support bytearrays when passed as parameters in the ``files`` argument. + (#2468) + +- Avoid data duplication when creating a request with ``str``, ``bytes``, or + ``bytearray`` input to the ``files`` argument. + 2.5.3 (2015-02-24) ++++++++++++++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/PKG-INFO new/requests-2.6.0/PKG-INFO --- old/requests-2.5.3/PKG-INFO 2015-02-24 17:33:44.000000000 +0100 +++ new/requests-2.6.0/PKG-INFO 2015-03-14 17:44:16.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: requests -Version: 2.5.3 +Version: 2.6.0 Summary: Python HTTP for Humans. Home-page: http://python-requests.org Author: Kenneth Reitz @@ -98,6 +98,36 @@ Release History --------------- + 2.6.0 (2015-03-14) + ++++++++++++++++++ + + **Bugfixes** + + - Fix handling of cookies on redirect. Previously a cookie without a host + value set would use the hostname for the redirected URL exposing requests + users to session fixation attacks and potentially cookie stealing. This was + disclosed privately by Matthew Daley of `BugFuzz <https://bugfuzz.com>`_. + An CVE identifier has not yet been assigned for this. This affects all + versions of requests from v2.1.0 to v2.5.3 (inclusive on both ends). + + - Fix error when requests is an ``install_requires`` dependency and ``python + setup.py test`` is run. (#2462) + + - Fix error when urllib3 is unbundled and requests continues to use the + vendored import location. + + - Include fixes to ``urllib3``'s header handling. + + - Requests' handling of unvendored dependencies is now more restrictive. + + **Features and Improvements** + + - Support bytearrays when passed as parameters in the ``files`` argument. + (#2468) + + - Avoid data duplication when creating a request with ``str``, ``bytes``, or + ``bytearray`` input to the ``files`` argument. + 2.5.3 (2015-02-24) ++++++++++++++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/__init__.py new/requests-2.6.0/requests/__init__.py --- old/requests-2.5.3/requests/__init__.py 2015-02-24 17:33:01.000000000 +0100 +++ new/requests-2.6.0/requests/__init__.py 2015-03-14 17:43:47.000000000 +0100 @@ -42,7 +42,7 @@ """ __title__ = 'requests' -__version__ = '2.5.3' +__version__ = '2.6.0' __build__ = 0x020503 __author__ = 'Kenneth Reitz' __license__ = 'Apache 2.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/adapters.py new/requests-2.6.0/requests/adapters.py --- old/requests-2.5.3/requests/adapters.py 2014-12-01 22:02:39.000000000 +0100 +++ new/requests-2.6.0/requests/adapters.py 2015-03-14 17:30:10.000000000 +0100 @@ -11,10 +11,10 @@ import socket from .models import Response -from .packages.urllib3 import Retry from .packages.urllib3.poolmanager import PoolManager, proxy_from_url from .packages.urllib3.response import HTTPResponse from .packages.urllib3.util import Timeout as TimeoutSauce +from .packages.urllib3.util.retry import Retry from .compat import urlparse, basestring from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers, prepend_scheme_if_needed, get_auth_from_url, urldefragauth) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/api.py new/requests-2.6.0/requests/api.py --- old/requests-2.5.3/requests/api.py 2014-11-16 18:39:53.000000000 +0100 +++ new/requests-2.6.0/requests/api.py 2015-03-14 17:30:10.000000000 +0100 @@ -16,7 +16,6 @@ def request(method, url, **kwargs): """Constructs and sends a :class:`Request <Request>`. - Returns :class:`Response <Response>` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. @@ -37,6 +36,8 @@ :param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided. :param stream: (optional) if ``False``, the response content will be immediately downloaded. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. + :return: :class:`Response <Response>` object + :rtype: requests.Response Usage:: @@ -55,10 +56,12 @@ def get(url, **kwargs): - """Sends a GET request. Returns :class:`Response` object. + """Sends a GET request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ kwargs.setdefault('allow_redirects', True) @@ -66,10 +69,12 @@ def options(url, **kwargs): - """Sends a OPTIONS request. Returns :class:`Response` object. + """Sends a OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ kwargs.setdefault('allow_redirects', True) @@ -77,10 +82,12 @@ def head(url, **kwargs): - """Sends a HEAD request. Returns :class:`Response` object. + """Sends a HEAD request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ kwargs.setdefault('allow_redirects', False) @@ -88,44 +95,52 @@ def post(url, data=None, json=None, **kwargs): - """Sends a POST request. Returns :class:`Response` object. + """Sends a POST request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json data to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ return request('post', url, data=data, json=json, **kwargs) def put(url, data=None, **kwargs): - """Sends a PUT request. Returns :class:`Response` object. + """Sends a PUT request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ return request('put', url, data=data, **kwargs) def patch(url, data=None, **kwargs): - """Sends a PATCH request. Returns :class:`Response` object. + """Sends a PATCH request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ return request('patch', url, data=data, **kwargs) def delete(url, **kwargs): - """Sends a DELETE request. Returns :class:`Response` object. + """Sends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response <Response>` object + :rtype: requests.Response """ return request('delete', url, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/models.py new/requests-2.6.0/requests/models.py --- old/requests-2.5.3/requests/models.py 2014-12-23 18:43:04.000000000 +0100 +++ new/requests-2.6.0/requests/models.py 2015-03-14 17:30:10.000000000 +0100 @@ -143,12 +143,13 @@ else: fn = guess_filename(v) or k fp = v - if isinstance(fp, str): - fp = StringIO(fp) - if isinstance(fp, bytes): - fp = BytesIO(fp) - rf = RequestField(name=k, data=fp.read(), + if isinstance(fp, (str, bytes, bytearray)): + fdata = fp + else: + fdata = fp.read() + + rf = RequestField(name=k, data=fdata, filename=fn, headers=fh) rf.make_multipart(content_type=ft) new_fields.append(rf) @@ -688,6 +689,8 @@ """Iterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. + + .. note:: This method is not reentrant safe. """ pending = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/packages/__init__.py new/requests-2.6.0/requests/packages/__init__.py --- old/requests-2.5.3/requests/packages/__init__.py 2015-02-24 17:27:00.000000000 +0100 +++ new/requests-2.6.0/requests/packages/__init__.py 2015-03-14 03:47:10.000000000 +0100 @@ -27,9 +27,13 @@ class VendorAlias(object): - def __init__(self): + def __init__(self, package_names): + self._package_names = package_names self._vendor_name = __name__ self._vendor_pkg = self._vendor_name + "." + self._vendor_pkgs = [ + self._vendor_pkg + name for name in self._package_names + ] def find_module(self, fullname, path=None): if fullname.startswith(self._vendor_pkg): @@ -44,6 +48,14 @@ ) ) + if not (name == self._vendor_name or + any(name.startswith(pkg) for pkg in self._vendor_pkgs)): + raise ImportError( + "Cannot import %s, must be one of %s." % ( + name, self._vendor_pkgs + ) + ) + # Check to see if we already have this item in sys.modules, if we do # then simply return that. if name in sys.modules: @@ -92,4 +104,4 @@ return module -sys.meta_path.append(VendorAlias()) +sys.meta_path.append(VendorAlias(["urllib3", "chardet"])) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/packages/urllib3/__init__.py new/requests-2.6.0/requests/packages/urllib3/__init__.py --- old/requests-2.5.3/requests/packages/urllib3/__init__.py 2015-02-24 17:27:00.000000000 +0100 +++ new/requests-2.6.0/requests/packages/urllib3/__init__.py 2015-03-12 02:52:01.000000000 +0100 @@ -4,7 +4,7 @@ __author__ = 'Andrey Petrov (andrey.pet...@shazow.net)' __license__ = 'MIT' -__version__ = 'dev' +__version__ = '1.10.2' from .connectionpool import ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/packages/urllib3/_collections.py new/requests-2.6.0/requests/packages/urllib3/_collections.py --- old/requests-2.5.3/requests/packages/urllib3/_collections.py 2015-02-24 17:27:00.000000000 +0100 +++ new/requests-2.6.0/requests/packages/urllib3/_collections.py 2015-03-12 02:52:01.000000000 +0100 @@ -20,8 +20,6 @@ __all__ = ['RecentlyUsedContainer', 'HTTPHeaderDict'] -MULTIPLE_HEADERS_ALLOWED = frozenset(['cookie', 'set-cookie', 'set-cookie2']) - _Null = object() @@ -143,7 +141,10 @@ def __init__(self, headers=None, **kwargs): dict.__init__(self) if headers is not None: - self.extend(headers) + if isinstance(headers, HTTPHeaderDict): + self._copy_from(headers) + else: + self.extend(headers) if kwargs: self.extend(kwargs) @@ -223,11 +224,8 @@ vals.append(val) else: # vals should be a tuple then, i.e. only one item so far - if key_lower in MULTIPLE_HEADERS_ALLOWED: - # Need to convert the tuple to list for further extension - _dict_setitem(self, key_lower, [vals[0], vals[1], val]) - else: - _dict_setitem(self, key_lower, new_vals) + # Need to convert the tuple to list for further extension + _dict_setitem(self, key_lower, [vals[0], vals[1], val]) def extend(*args, **kwargs): """Generic import function for any type of header-like object. @@ -276,14 +274,17 @@ def __repr__(self): return "%s(%s)" % (type(self).__name__, dict(self.itermerged())) - def copy(self): - clone = type(self)() - for key in self: - val = _dict_getitem(self, key) + def _copy_from(self, other): + for key in other: + val = _dict_getitem(other, key) if isinstance(val, list): # Don't need to convert tuples val = list(val) - _dict_setitem(clone, key, val) + _dict_setitem(self, key, val) + + def copy(self): + clone = type(self)() + clone._copy_from(self) return clone def iteritems(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/packages/urllib3/exceptions.py new/requests-2.6.0/requests/packages/urllib3/exceptions.py --- old/requests-2.5.3/requests/packages/urllib3/exceptions.py 2014-12-01 22:02:39.000000000 +0100 +++ new/requests-2.6.0/requests/packages/urllib3/exceptions.py 2015-03-12 02:52:01.000000000 +0100 @@ -157,3 +157,8 @@ class SystemTimeWarning(SecurityWarning): "Warned when system time is suspected to be wrong" pass + + +class InsecurePlatformWarning(SecurityWarning): + "Warned when certain SSL configuration is not available on a platform." + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/packages/urllib3/util/ssl_.py new/requests-2.6.0/requests/packages/urllib3/util/ssl_.py --- old/requests-2.5.3/requests/packages/urllib3/util/ssl_.py 2015-02-24 17:27:00.000000000 +0100 +++ new/requests-2.6.0/requests/packages/urllib3/util/ssl_.py 2015-03-12 02:52:01.000000000 +0100 @@ -1,7 +1,7 @@ from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 -from ..exceptions import SSLError +from ..exceptions import SSLError, InsecurePlatformWarning SSLContext = None @@ -10,6 +10,7 @@ import errno import ssl +import warnings try: # Test for SSL features from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23 @@ -69,6 +70,14 @@ self.ciphers = cipher_suite def wrap_socket(self, socket, server_hostname=None): + warnings.warn( + 'A true SSLContext object is not available. This prevents ' + 'urllib3 from configuring SSL appropriately and may cause ' + 'certain SSL connections to fail. For more information, see ' + 'https://urllib3.readthedocs.org/en/latest/security.html' + '#insecureplatformwarning.', + InsecurePlatformWarning + ) kwargs = { 'keyfile': self.keyfile, 'certfile': self.certfile, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests/sessions.py new/requests-2.6.0/requests/sessions.py --- old/requests-2.5.3/requests/sessions.py 2014-12-01 22:02:39.000000000 +0100 +++ new/requests-2.6.0/requests/sessions.py 2015-03-14 17:30:10.000000000 +0100 @@ -171,7 +171,10 @@ except KeyError: pass - extract_cookies_to_jar(prepared_request._cookies, prepared_request, resp.raw) + # Extract any cookies sent on the response to the cookiejar + # in the new request. Because we've mutated our copied prepared + # request, use the old one that we haven't yet touched. + extract_cookies_to_jar(prepared_request._cookies, req, resp.raw) prepared_request._cookies.update(self.cookies) prepared_request.prepare_cookies(prepared_request._cookies) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests.egg-info/PKG-INFO new/requests-2.6.0/requests.egg-info/PKG-INFO --- old/requests-2.5.3/requests.egg-info/PKG-INFO 2015-02-24 17:33:43.000000000 +0100 +++ new/requests-2.6.0/requests.egg-info/PKG-INFO 2015-03-14 17:44:16.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: requests -Version: 2.5.3 +Version: 2.6.0 Summary: Python HTTP for Humans. Home-page: http://python-requests.org Author: Kenneth Reitz @@ -98,6 +98,36 @@ Release History --------------- + 2.6.0 (2015-03-14) + ++++++++++++++++++ + + **Bugfixes** + + - Fix handling of cookies on redirect. Previously a cookie without a host + value set would use the hostname for the redirected URL exposing requests + users to session fixation attacks and potentially cookie stealing. This was + disclosed privately by Matthew Daley of `BugFuzz <https://bugfuzz.com>`_. + An CVE identifier has not yet been assigned for this. This affects all + versions of requests from v2.1.0 to v2.5.3 (inclusive on both ends). + + - Fix error when requests is an ``install_requires`` dependency and ``python + setup.py test`` is run. (#2462) + + - Fix error when urllib3 is unbundled and requests continues to use the + vendored import location. + + - Include fixes to ``urllib3``'s header handling. + + - Requests' handling of unvendored dependencies is now more restrictive. + + **Features and Improvements** + + - Support bytearrays when passed as parameters in the ``files`` argument. + (#2468) + + - Avoid data duplication when creating a request with ``str``, ``bytes``, or + ``bytearray`` input to the ``files`` argument. + 2.5.3 (2015-02-24) ++++++++++++++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/requests.egg-info/requires.txt new/requests-2.6.0/requests.egg-info/requires.txt --- old/requests-2.5.3/requests.egg-info/requires.txt 2015-02-24 17:33:43.000000000 +0100 +++ new/requests-2.6.0/requests.egg-info/requires.txt 2015-03-14 17:44:16.000000000 +0100 @@ -1,5 +1,6 @@ + [security] pyOpenSSL ndg-httpsclient -pyasn1 +pyasn1 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/setup.py new/requests-2.6.0/setup.py --- old/requests-2.5.3/setup.py 2014-09-10 17:30:41.000000000 +0200 +++ new/requests-2.6.0/setup.py 2015-03-14 17:30:10.000000000 +0100 @@ -1,10 +1,9 @@ #!/usr/bin/env python import os +import re import sys -import requests - from codecs import open try: @@ -29,6 +28,18 @@ requires = [] +version = '' +with open('requests/__init__.py', 'r') as fd: + reg = re.compile(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]') + for line in fd: + m = reg.match(line) + if m: + version = m.group(1) + break + +if not version: + raise RuntimeError('Cannot find version information') + with open('README.rst', 'r', 'utf-8') as f: readme = f.read() with open('HISTORY.rst', 'r', 'utf-8') as f: @@ -36,7 +47,7 @@ setup( name='requests', - version=requests.__version__, + version=version, description='Python HTTP for Humans.', long_description=readme + '\n\n' + history, author='Kenneth Reitz', @@ -60,7 +71,6 @@ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4' - ), extras_require={ 'security': ['pyOpenSSL', 'ndg-httpsclient', 'pyasn1'], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/requests-2.5.3/test_requests.py new/requests-2.6.0/test_requests.py --- old/requests-2.5.3/test_requests.py 2015-02-24 17:27:00.000000000 +0100 +++ new/requests-2.6.0/test_requests.py 2015-03-11 16:02:15.000000000 +0100 @@ -935,6 +935,19 @@ assert 'multipart/form-data' in p.headers['Content-Type'] + def test_can_send_bytes_bytearray_objects_with_files(self): + # Test bytes: + data = {'a': 'this is a string'} + files = {'b': b'foo'} + r = requests.Request('POST', httpbin('post'), data=data, files=files) + p = r.prepare() + assert 'multipart/form-data' in p.headers['Content-Type'] + # Test bytearrays: + files = {'b': bytearray(b'foo')} + r = requests.Request('POST', httpbin('post'), data=data, files=files) + p = r.prepare() + assert 'multipart/form-data' in p.headers['Content-Type'] + def test_can_send_file_object_with_non_string_filename(self): f = io.BytesIO() f.name = 2 @@ -1039,6 +1052,23 @@ assert 'application/json' in r.request.headers['Content-Type'] assert {'life': 42} == r.json()['json'] + def test_response_iter_lines(self): + r = requests.get(httpbin('stream/4'), stream=True) + assert r.status_code == 200 + + it = r.iter_lines() + next(it) + assert len(list(it)) == 3 + + @pytest.mark.xfail + def test_response_iter_lines_reentrant(self): + """Response.iter_lines() is not reentrant safe""" + r = requests.get(httpbin('stream/4'), stream=True) + assert r.status_code == 200 + + next(r.iter_lines()) + assert len(list(r.iter_lines())) == 3 + class TestContentEncodingDetection(unittest.TestCase): @@ -1598,5 +1628,12 @@ with pytest.raises(RetryError): s.get(httpbin('status/500')) +def test_vendor_aliases(): + from requests.packages import urllib3 + from requests.packages import chardet + + with pytest.raises(ImportError): + from requests.packages import webbrowser + if __name__ == '__main__': unittest.main() -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org