summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2015-12-04 21:48:21 +0000
committerwiz <wiz@pkgsrc.org>2015-12-04 21:48:21 +0000
commit88547561f05b8d68c96aa8c18ff9f862b7ca8da3 (patch)
tree1fdca5923758d78d6f6a9c679657da5bc33d8761 /devel
parentb5b4e330d9fda21b72ef530d4761ab80fa096ba7 (diff)
downloadpkgsrc-88547561f05b8d68c96aa8c18ff9f862b7ca8da3.tar.gz
Update py-requests-toolbelt to 0.5.0.
Add test dependencies. All tests pass. 0.5.0 -- 2015-11-24 ------------------- More information about this release can be found on the `milestone <https://github.com/sigmavirus24/requests-toolbelt/issues?utf8=%E2%9C%93&q=is%3Aall+milestone%3A0.5+>`_ for 0.5.0. New Features ~~~~~~~~~~~~ - The ``tee`` submodule was added to ``requests_toolbelt.downloadutils``. It allows you to iterate over the bytes of a response while also writing them to a file. The ``tee.tee`` function, expects you to pass an open file object, while ``tee.tee_to_file`` will use the provided file name to open the file for you. - Added a new parameter to ``requests_toolbelt.utils.user_agent`` that allows the user to specify additional items. - Added nested form-data helper, ``requests_toolbelt.utils.formdata.urlencode``. - Added the ``ForgetfulCookieJar`` to ``requests_toolbelt.cookies``. - Added utilities for dumping the information about a request-response cycle in ``requests_toolbelt.utils.dump``. - Implemented the API described in the ``requests_toolbelt.threaded`` module docstring, i.e., added ``requests_toolbelt.threaded.map`` as an available function. Fixed Bugs ~~~~~~~~~~ - Now papers over the API differences in versions of requests installed from system packages versus versions of requests installed from PyPI. - Allow string types for ``SourceAddressAdapter``.
Diffstat (limited to 'devel')
-rw-r--r--devel/py-requests-toolbelt/Makefile8
-rw-r--r--devel/py-requests-toolbelt/PLIST20
-rw-r--r--devel/py-requests-toolbelt/distinfo13
-rw-r--r--devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth___digest__auth__compat.py47
-rw-r--r--devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_guess.py108
-rw-r--r--devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_http__proxy__digest.py68
6 files changed, 29 insertions, 235 deletions
diff --git a/devel/py-requests-toolbelt/Makefile b/devel/py-requests-toolbelt/Makefile
index 493429a89b7..c64b6f28fd7 100644
--- a/devel/py-requests-toolbelt/Makefile
+++ b/devel/py-requests-toolbelt/Makefile
@@ -1,8 +1,7 @@
-# $NetBSD: Makefile,v 1.4 2015/11/24 10:27:26 wiz Exp $
+# $NetBSD: Makefile,v 1.5 2015/12/04 21:48:21 wiz Exp $
-DISTNAME= requests-toolbelt-0.4.0
+DISTNAME= requests-toolbelt-0.5.0
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
-PKGREVISION= 1
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_PYPI:=r/requests-toolbelt/}
@@ -12,6 +11,9 @@ COMMENT= Utility belt for advanced users of python-requests
LICENSE= apache-2.0
DEPENDS+= ${PYPKGPREFIX}-requests>=2.1.0:../../devel/py-requests
+BUILD_DEPENDS+= ${PYPKGPREFIX}-betamax-[0-9]*:../../www/py-betamax
+BUILD_DEPENDS+= ${PYPKGPREFIX}-mock-[0-9]*:../../devel/py-mock
+BUILD_DEPENDS+= ${PYPKGPREFIX}-test-[0-9]*:../../devel/py-test
USE_LANGUAGES= # none
diff --git a/devel/py-requests-toolbelt/PLIST b/devel/py-requests-toolbelt/PLIST
index aad35cb6d70..0bdfe6746d7 100644
--- a/devel/py-requests-toolbelt/PLIST
+++ b/devel/py-requests-toolbelt/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.3 2015/11/24 10:27:26 wiz Exp $
+@comment $NetBSD: PLIST,v 1.4 2015/12/04 21:48:21 wiz Exp $
${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
@@ -7,6 +7,9 @@ ${PYSITELIB}/${EGG_INFODIR}/top_level.txt
${PYSITELIB}/requests_toolbelt/__init__.py
${PYSITELIB}/requests_toolbelt/__init__.pyc
${PYSITELIB}/requests_toolbelt/__init__.pyo
+${PYSITELIB}/requests_toolbelt/_compat.py
+${PYSITELIB}/requests_toolbelt/_compat.pyc
+${PYSITELIB}/requests_toolbelt/_compat.pyo
${PYSITELIB}/requests_toolbelt/adapters/__init__.py
${PYSITELIB}/requests_toolbelt/adapters/__init__.pyc
${PYSITELIB}/requests_toolbelt/adapters/__init__.pyo
@@ -37,12 +40,21 @@ ${PYSITELIB}/requests_toolbelt/auth/handler.pyo
${PYSITELIB}/requests_toolbelt/auth/http_proxy_digest.py
${PYSITELIB}/requests_toolbelt/auth/http_proxy_digest.pyc
${PYSITELIB}/requests_toolbelt/auth/http_proxy_digest.pyo
+${PYSITELIB}/requests_toolbelt/cookies/__init__.py
+${PYSITELIB}/requests_toolbelt/cookies/__init__.pyc
+${PYSITELIB}/requests_toolbelt/cookies/__init__.pyo
+${PYSITELIB}/requests_toolbelt/cookies/forgetful.py
+${PYSITELIB}/requests_toolbelt/cookies/forgetful.pyc
+${PYSITELIB}/requests_toolbelt/cookies/forgetful.pyo
${PYSITELIB}/requests_toolbelt/downloadutils/__init__.py
${PYSITELIB}/requests_toolbelt/downloadutils/__init__.pyc
${PYSITELIB}/requests_toolbelt/downloadutils/__init__.pyo
${PYSITELIB}/requests_toolbelt/downloadutils/stream.py
${PYSITELIB}/requests_toolbelt/downloadutils/stream.pyc
${PYSITELIB}/requests_toolbelt/downloadutils/stream.pyo
+${PYSITELIB}/requests_toolbelt/downloadutils/tee.py
+${PYSITELIB}/requests_toolbelt/downloadutils/tee.pyc
+${PYSITELIB}/requests_toolbelt/downloadutils/tee.pyo
${PYSITELIB}/requests_toolbelt/exceptions.py
${PYSITELIB}/requests_toolbelt/exceptions.pyc
${PYSITELIB}/requests_toolbelt/exceptions.pyo
@@ -73,6 +85,12 @@ ${PYSITELIB}/requests_toolbelt/utils/__init__.pyo
${PYSITELIB}/requests_toolbelt/utils/deprecated.py
${PYSITELIB}/requests_toolbelt/utils/deprecated.pyc
${PYSITELIB}/requests_toolbelt/utils/deprecated.pyo
+${PYSITELIB}/requests_toolbelt/utils/dump.py
+${PYSITELIB}/requests_toolbelt/utils/dump.pyc
+${PYSITELIB}/requests_toolbelt/utils/dump.pyo
+${PYSITELIB}/requests_toolbelt/utils/formdata.py
+${PYSITELIB}/requests_toolbelt/utils/formdata.pyc
+${PYSITELIB}/requests_toolbelt/utils/formdata.pyo
${PYSITELIB}/requests_toolbelt/utils/user_agent.py
${PYSITELIB}/requests_toolbelt/utils/user_agent.pyc
${PYSITELIB}/requests_toolbelt/utils/user_agent.pyo
diff --git a/devel/py-requests-toolbelt/distinfo b/devel/py-requests-toolbelt/distinfo
index acef1c0a112..70bbe5a7315 100644
--- a/devel/py-requests-toolbelt/distinfo
+++ b/devel/py-requests-toolbelt/distinfo
@@ -1,9 +1,6 @@
-$NetBSD: distinfo,v 1.4 2015/11/24 10:27:26 wiz Exp $
+$NetBSD: distinfo,v 1.5 2015/12/04 21:48:21 wiz Exp $
-SHA1 (requests-toolbelt-0.4.0.tar.gz) = 89034149cb90c4ba825bbc8c68a590c3ad41f067
-RMD160 (requests-toolbelt-0.4.0.tar.gz) = 06759883eac9d07a4a5a037746c9d36140f8396d
-SHA512 (requests-toolbelt-0.4.0.tar.gz) = f3fce2f93c1152a7f42bed57bcff5910f2cb5cae27d3beea58ddfac556752c65c30e3dfd0409bcc110073d1e42edba873886c99129811115b297eb26f071577d
-Size (requests-toolbelt-0.4.0.tar.gz) = 25451 bytes
-SHA1 (patch-requests__toolbelt_auth___digest__auth__compat.py) = 662f4681dff1f1795597770b50fc2c1fb6955fa0
-SHA1 (patch-requests__toolbelt_auth_guess.py) = 352acc6d4b9a98d17133257edb497743c8d09191
-SHA1 (patch-requests__toolbelt_auth_http__proxy__digest.py) = 65fe748ff7de4ebcfdc7799c4134372007d124ff
+SHA1 (requests-toolbelt-0.5.0.tar.gz) = 5d7af9b9b3a80f627170461132dcf5c15d9b1f45
+RMD160 (requests-toolbelt-0.5.0.tar.gz) = 0f9cf8ecb6cccf24ba2540cb21996684d4130d2a
+SHA512 (requests-toolbelt-0.5.0.tar.gz) = 9f01f5783f5ab852fc6bc536a8ede23ad102d7ae0a476e3c749e1d63bc3466da3212259fd2276c35e95d987e64d72036c6d7f10727cc242b5b3026e884d0c014
+Size (requests-toolbelt-0.5.0.tar.gz) = 182971 bytes
diff --git a/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth___digest__auth__compat.py b/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth___digest__auth__compat.py
deleted file mode 100644
index 8f5672a4726..00000000000
--- a/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth___digest__auth__compat.py
+++ /dev/null
@@ -1,47 +0,0 @@
-$NetBSD: patch-requests__toolbelt_auth___digest__auth__compat.py,v 1.1 2015/11/24 10:27:26 wiz Exp $
-
-Fix authentication handlers using digest auth
-
-Requests 2.8.0 introduced a thread-safe HTTPDigestAuth class which was
-backwards incompatible for anything that attempts to work with it. This
-adds a compatibility layer for convenience based on the version of
-requests that is installed alongside the toolbelt.
-
-This also updates the HTTPProxyDigestAuth class to be threadsafe by
-utilizing the thread local storage when it is available.
-
-Closes #108
-https://github.com/sigmavirus24/requests-toolbelt/commit/d4eba75097c0f65448afb6dfab2029d3fefb02b9
-
---- requests_toolbelt/auth/_digest_auth_compat.py.orig 2015-11-24 10:22:14.000000000 +0000
-+++ requests_toolbelt/auth/_digest_auth_compat.py
-@@ -0,0 +1,29 @@
-+"""Provide a compatibility layer for requests.auth.HTTPDigestAuth."""
-+import requests
-+
-+
-+class _ThreadingDescriptor(object):
-+ def __init__(self, prop, default):
-+ self.prop = prop
-+ self.default = default
-+
-+ def __get__(self, obj, objtype=None):
-+ return getattr(obj._thread_local, self.prop, self.default)
-+
-+ def __set__(self, obj, value):
-+ setattr(obj._thread_local, self.prop, value)
-+
-+
-+class _HTTPDigestAuth(requests.auth.HTTPDigestAuth):
-+ init = _ThreadingDescriptor('init', True)
-+ last_nonce = _ThreadingDescriptor('last_nonce', '')
-+ nonce_count = _ThreadingDescriptor('nonce_count', 0)
-+ chal = _ThreadingDescriptor('chal', {})
-+ pos = _ThreadingDescriptor('pos', None)
-+ num_401_calls = _ThreadingDescriptor('num_401_calls', 1)
-+
-+
-+if requests.__build__ < 0x020800:
-+ HTTPDigestAuth = requests.auth.HTTPDigestAuth
-+else:
-+ HTTPDigestAuth = _HTTPDigestAuth
diff --git a/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_guess.py b/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_guess.py
deleted file mode 100644
index d88e6a294e9..00000000000
--- a/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_guess.py
+++ /dev/null
@@ -1,108 +0,0 @@
-$NetBSD: patch-requests__toolbelt_auth_guess.py,v 1.1 2015/11/24 10:27:26 wiz Exp $
-
-Fix authentication handlers using digest auth
-
-Requests 2.8.0 introduced a thread-safe HTTPDigestAuth class which was
-backwards incompatible for anything that attempts to work with it. This
-adds a compatibility layer for convenience based on the version of
-requests that is installed alongside the toolbelt.
-
-This also updates the HTTPProxyDigestAuth class to be threadsafe by
-utilizing the thread local storage when it is available.
-
-Closes #108
-https://github.com/sigmavirus24/requests-toolbelt/commit/d4eba75097c0f65448afb6dfab2029d3fefb02b9
-
---- requests_toolbelt/auth/guess.py.orig 2015-03-29 04:12:14.000000000 +0000
-+++ requests_toolbelt/auth/guess.py
-@@ -3,6 +3,8 @@
- from requests import auth
- from requests import cookies
-
-+from . import _digest_auth_compat as auth_compat
-+
-
- class GuessAuth(auth.AuthBase):
- """Guesses the auth type by the WWW-Authentication header."""
-@@ -12,38 +14,57 @@ class GuessAuth(auth.AuthBase):
- self.auth = None
- self.pos = None
-
-+ def _handle_basic_auth_401(self, r, kwargs):
-+ if self.pos is not None:
-+ r.request.body.seek(self.pos)
-+
-+ # Consume content and release the original connection
-+ # to allow our new request to reuse the same one.
-+ r.content
-+ r.raw.release_conn()
-+ prep = r.request.copy()
-+ if not hasattr(prep, '_cookies'):
-+ prep._cookies = cookies.RequestsCookieJar()
-+ cookies.extract_cookies_to_jar(prep._cookies, r.request, r.raw)
-+ prep.prepare_cookies(prep._cookies)
-+
-+ self.auth = auth.HTTPBasicAuth(self.username, self.password)
-+ prep = self.auth(prep)
-+ _r = r.connection.send(prep, **kwargs)
-+ _r.history.append(r)
-+ _r.request = prep
-+
-+ return _r
-+
-+ def _handle_digest_auth_401(self, r, kwargs):
-+ self.auth = auth_compat.HTTPDigestAuth(self.username, self.password)
-+ try:
-+ self.auth.init_per_thread_state()
-+ except AttributeError:
-+ # If we're not on requests 2.8.0+ this method does not exist and
-+ # is not relevant.
-+ pass
-+
-+ # Check that the attr exists because much older versions of requests
-+ # set this attribute lazily. For example:
-+ # https://github.com/kennethreitz/requests/blob/33735480f77891754304e7f13e3cdf83aaaa76aa/requests/auth.py#L59
-+ if (hasattr(self.auth, 'num_401_calls')
-+ and self.auth.num_401_calls is None):
-+ self.auth.num_401_calls = 1
-+ # Digest auth would resend the request by itself. We can take a
-+ # shortcut here.
-+ return self.auth.handle_401(r, **kwargs)
-+
- def handle_401(self, r, **kwargs):
- """Resends a request with auth headers, if needed."""
-
- www_authenticate = r.headers.get('www-authenticate', '').lower()
-
- if 'basic' in www_authenticate:
-- if self.pos is not None:
-- r.request.body.seek(self.pos)
--
-- # Consume content and release the original connection
-- # to allow our new request to reuse the same one.
-- r.content
-- r.raw.release_conn()
-- prep = r.request.copy()
-- if not hasattr(prep, '_cookies'):
-- prep._cookies = cookies.RequestsCookieJar()
-- cookies.extract_cookies_to_jar(prep._cookies, r.request, r.raw)
-- prep.prepare_cookies(prep._cookies)
--
-- self.auth = auth.HTTPBasicAuth(self.username, self.password)
-- prep = self.auth(prep)
-- _r = r.connection.send(prep, **kwargs)
-- _r.history.append(r)
-- _r.request = prep
--
-- return _r
-+ return self._handle_basic_auth_401(r, kwargs)
-
- if 'digest' in www_authenticate:
-- self.auth = auth.HTTPDigestAuth(self.username, self.password)
-- # Digest auth would resend the request by itself. We can take a
-- # shortcut here.
-- return self.auth.handle_401(r, **kwargs)
-+ return self._handle_digest_auth_401(r, kwargs)
-
- def __call__(self, request):
- if self.auth is not None:
diff --git a/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_http__proxy__digest.py b/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_http__proxy__digest.py
deleted file mode 100644
index d10e1575a57..00000000000
--- a/devel/py-requests-toolbelt/patches/patch-requests__toolbelt_auth_http__proxy__digest.py
+++ /dev/null
@@ -1,68 +0,0 @@
-$NetBSD: patch-requests__toolbelt_auth_http__proxy__digest.py,v 1.1 2015/11/24 10:27:26 wiz Exp $
-
-Fix authentication handlers using digest auth
-
-Requests 2.8.0 introduced a thread-safe HTTPDigestAuth class which was
-backwards incompatible for anything that attempts to work with it. This
-adds a compatibility layer for convenience based on the version of
-requests that is installed alongside the toolbelt.
-
-This also updates the HTTPProxyDigestAuth class to be threadsafe by
-utilizing the thread local storage when it is available.
-
-Closes #108
-https://github.com/sigmavirus24/requests-toolbelt/commit/d4eba75097c0f65448afb6dfab2029d3fefb02b9
-
---- requests_toolbelt/auth/http_proxy_digest.py.orig 2015-03-29 04:12:14.000000000 +0000
-+++ requests_toolbelt/auth/http_proxy_digest.py
-@@ -2,9 +2,10 @@
- """The module containing HTTPProxyDigestAuth."""
- import re
-
--from requests import auth
- from requests import cookies
-
-+from . import _digest_auth_compat as auth
-+
-
- class HTTPProxyDigestAuth(auth.HTTPDigestAuth):
- """HTTP digest authentication between proxy
-@@ -21,6 +22,30 @@ class HTTPProxyDigestAuth(auth.HTTPDiges
- super(HTTPProxyDigestAuth, self).__init__(*args, **kwargs)
- self.stale_rejects = 0
-
-+ self.init_per_thread_state()
-+
-+ @property
-+ def stale_rejects(self):
-+ thread_local = getattr(self, '_thread_local', None)
-+ if thread_local is None:
-+ return self._stale_rejects
-+ return thread_local.stale_rejects
-+
-+ @stale_rejects.setter
-+ def stale_rejects(self, value):
-+ thread_local = getattr(self, '_thread_local', None)
-+ if thread_local is None:
-+ self._stale_rejects = value
-+ else:
-+ thread_local.stale_rejects = value
-+
-+ def init_per_thread_state(self):
-+ try:
-+ super(HTTPProxyDigestAuth, self).init_per_thread_state()
-+ except AttributeError:
-+ # If we're not on requests 2.8.0+ this method does not exist
-+ pass
-+
- def handle_407(self, r, **kwargs):
- """Handle HTTP 407 only once, otherwise give up
-
-@@ -64,6 +89,7 @@ class HTTPProxyDigestAuth(auth.HTTPDiges
- return r
-
- def __call__(self, r):
-+ self.init_per_thread_state()
- # if we have nonce, then just use it, otherwise server will tell us
- if self.last_nonce:
- r.headers['Proxy-Authorization'] = self.build_digest_header(