From 3415e6de0b4584e9e0ff27f346aac498a8c506b2 Mon Sep 17 00:00:00 2001 From: Jonas Obrist Date: Fri, 6 Jan 2012 16:20:33 +0100 Subject: [PATCH 1/4] Give a more useful error message when the URL supplied does not contain a schema. --- requests/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests/models.py b/requests/models.py index a16bcf23..a26e7047 100644 --- a/requests/models.py +++ b/requests/models.py @@ -298,7 +298,7 @@ class Request(object): scheme, netloc, path, params, query, fragment = urlparse(self.url) if not scheme: - raise ValueError() + raise ValueError("Invalid URL %r: No schema supplied" %r self.url) netloc = netloc.encode('idna') From d339ffe9d92ca3c3c6418923fa6bd17799549e3d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 6 Jan 2012 11:36:04 -0500 Subject: [PATCH 2/4] @ojii --- AUTHORS.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index e61f8d99..bf7a8436 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -69,3 +69,5 @@ Patches and Suggestions - Ori Livneh - Jason Emerick - Bryan Helmig +- Jonas Obrist + From a25141f9f42f481a70debbcf20977e7b208c03d9 Mon Sep 17 00:00:00 2001 From: Ben Edwards Date: Fri, 6 Jan 2012 13:52:49 -0700 Subject: [PATCH 3/4] Fix syntax error in last commit. --- requests/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests/models.py b/requests/models.py index a26e7047..6cb9aebb 100644 --- a/requests/models.py +++ b/requests/models.py @@ -298,7 +298,7 @@ class Request(object): scheme, netloc, path, params, query, fragment = urlparse(self.url) if not scheme: - raise ValueError("Invalid URL %r: No schema supplied" %r self.url) + raise ValueError("Invalid URL %r: No schema supplied" %self.url) netloc = netloc.encode('idna') From 15396fb2f90e30f1abe7ed63ddcf07f7706ba75b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 7 Jan 2012 13:44:09 -0500 Subject: [PATCH 4/4] Update docs/user/advanced.rst --- docs/user/advanced.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index 216367a0..d1c2cd0c 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -53,9 +53,9 @@ Requests can verify SSL certificates for HTTPS requests, just like a web browser >>> requests.get('https://kennethreitz.com', verify=True) requests.exceptions.SSLError: hostname 'kennethreitz.com' doesn't match either of '*.herokuapp.com', 'herokuapp.com' -I don't have SSL setup on this domain, so it fails. Excellent. I do have certs for httpbin.org though:: +I don't have SSL setup on this domain, so it fails. Excellent. Github does though:: - >>> requests.get('https://httpbin.org', verify=True) + >>> requests.get('https://github.com', verify=True) You can also pass ``verify`` the path to a CA_BUNDLE file for private certs. You can also set the ``REQUESTS_CA_BUNDLE`` environment variable.