Update to python-requests-1.1.0 (rhbz #915476)

This commit is contained in:
Ralph Bean 2013-02-27 09:35:23 -05:00
parent 4d0266ee28
commit 9d1befdf08
5 changed files with 66 additions and 60 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@
/requests-0.11.1.tar.gz /requests-0.11.1.tar.gz
/requests-0.13.1.tar.gz /requests-0.13.1.tar.gz
/requests-0.14.1.tar.gz /requests-0.14.1.tar.gz
/requests-1.1.0.tar.gz

View File

@ -1,35 +0,0 @@
From 2cecc4bc828fc1754cc26f279ec3ff5cd65cb8f7 Mon Sep 17 00:00:00 2001
From: Ralph Bean <rbean@redhat.com>
Date: Thu, 31 Jan 2013 21:38:58 -0500
Subject: [PATCH] cookie handling
---
requests/models.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/requests/models.py b/requests/models.py
index 2193c6e..0a12237 100644
--- a/requests/models.py
+++ b/requests/models.py
@@ -17,7 +17,7 @@ from .structures import CaseInsensitiveDict
from .status_codes import codes
from .auth import HTTPBasicAuth, HTTPProxyAuth
-from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header
+from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header, RequestsCookieJar
from .packages.urllib3.exceptions import MaxRetryError, LocationParseError
from .packages.urllib3.exceptions import TimeoutError
from .packages.urllib3.exceptions import SSLError as _SSLError
@@ -207,7 +207,8 @@ class Request(object):
extract_cookies_to_jar(self.cookies, self, resp)
# Save cookies in Response.
- response.cookies = self.cookies
+ response.cookies = RequestsCookieJar()
+ extract_cookies_to_jar(response.cookies, self, resp)
# Save cookies in Session.
for cookie in self.cookies:
--
1.8.1

View File

@ -1,16 +1,44 @@
Index: requests-0.14.1/requests/certs.py From 415619361cc23dd87b1a7a5fd0cfba38e33d24fd Mon Sep 17 00:00:00 2001
=================================================================== From: Ralph Bean <rbean@redhat.com>
--- requests-0.14.1.orig/requests/certs.py Date: Wed, 27 Feb 2013 09:16:20 -0500
+++ requests-0.14.1/requests/certs.py Subject: [PATCH] system cert bundle
@@ -21,7 +21,10 @@ def where():
return certifi.where() ---
else: requests/certs.py | 17 +++++------------
f = os.path.split(__file__)[0] 1 file changed, 5 insertions(+), 12 deletions(-)
- return os.path.join(f, 'cacert.pem')
+ path = os.path.join(f, 'cacert.pem') diff --git a/requests/certs.py b/requests/certs.py
+ if os.path.exists(path): index 8148276..6e07f5e 100644
+ return path --- a/requests/certs.py
+ return None +++ b/requests/certs.py
@@ -10,22 +10,15 @@ This module returns the preferred default CA certificate bundle.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
-"""
-
-import os.path
-certifi = None
-try:
- import certifi
-except ImportError:
- pass
+We return "/etc/pki/tls/certs/ca-bundle.crt" provided by the ca-certificates
+package.
+"""
def where():
"""Return the preferred certificate bundle."""
- if certifi:
- return certifi.where()
-
- return os.path.join(os.path.dirname(__file__), 'cacert.pem')
+ # Don't use the certs bundled with requests, use ca-certificates'.
+ return "/etc/pki/tls/certs/ca-bundle.crt"
if __name__ == '__main__': if __name__ == '__main__':
print(where()) print(where())
--
1.8.1.2

View File

@ -3,21 +3,17 @@
%else %else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif %endif
Name: python-requests Name: python-requests
Version: 0.14.1 Version: 1.1.0
Release: 4%{?dist} Release: 1%{?dist}
Summary: HTTP library, written in Python, for human beings Summary: HTTP library, written in Python, for human beings
License: ISC and MIT License: ASL 2.0
URL: http://pypi.python.org/pypi/requests URL: http://pypi.python.org/pypi/requests
Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz
# Separate response cookies from request cookies discussed here: # Explicitly use the system certificates in ca-certificates.
# https://github.com/fedora-infra/python-fedora/pull/6 Patch0: python-requests-system-cert-bundle.patch
Patch0: python-requests-cookie-handling.patch
# Use the system certificates in ca-certificates. This patch causes util.py
# to search for the system bundle (whereas now the return value of
# certs.where() causes it to always use the bundled version.
Patch1: python-requests-system-cert-bundle.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel BuildRequires: python2-devel
@ -45,7 +41,6 @@ designed to make HTTP requests easy for developers.
%setup -q -n requests-%{version} %setup -q -n requests-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
### TODO: Need to unbundle libraries in the packages directory. ### TODO: Need to unbundle libraries in the packages directory.
### https://bugzilla.redhat.com/show_bug.cgi?id=904623 ### https://bugzilla.redhat.com/show_bug.cgi?id=904623
@ -97,6 +92,16 @@ popd
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
## The tests succeed if run locally, but fail in koji.
## They require an active network connection to query httpbin.org
#%%check
#%%{__python} test_requests.py
#%%if 0%%{?_with_python3}
#pushd %%{py3dir}
#%%{__python3} test_requests.py
#popd
#%%endif
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc NOTICE LICENSE README.rst HISTORY.rst %doc NOTICE LICENSE README.rst HISTORY.rst
@ -112,6 +117,13 @@ popd
%changelog %changelog
* Tue Feb 26 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-1
- Latest upstream.
- Relicense to ASL 2.0 with upstream.
- Removed cookie handling patch (fixed in upstream tarball).
- Updated cert unbundling patch to match upstream.
- Added check section, but left it commented out for koji.
* Fri Feb 8 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 0.14.1-4 * Fri Feb 8 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 0.14.1-4
- Let brp_python_bytecompile run again, take care of the non-python{2,3} modules - Let brp_python_bytecompile run again, take care of the non-python{2,3} modules
by removing them from the python{,3}-requests package that they did not belong by removing them from the python{,3}-requests package that they did not belong

View File

@ -1 +1 @@
3de30600072cbc7214ae342d1d08aa46 requests-0.14.1.tar.gz a0158815af244c32041a3147ee09abf3 requests-1.1.0.tar.gz