From 3615cbc9df85a7fe374c1a7e3fe2c64ad91fe0ea Mon Sep 17 00:00:00 2001 From: anatomyofashane Date: Mon, 31 Oct 2011 22:24:59 -0300 Subject: [PATCH 01/25] Update docs/_themes/kr/static/flasky.css_t --- docs/_themes/kr/static/flasky.css_t | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/_themes/kr/static/flasky.css_t b/docs/_themes/kr/static/flasky.css_t index aa3e8ebb..6610b88c 100644 --- a/docs/_themes/kr/static/flasky.css_t +++ b/docs/_themes/kr/static/flasky.css_t @@ -393,6 +393,11 @@ a:hover tt { display: none; } + div.document { + width: 100%; + + } + div.documentwrapper { margin-left: 0; margin-top: 0; From 4fcf14e1240ba5e9e183fc1d785b7c5594857d5d Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Mon, 31 Oct 2011 21:50:57 -0400 Subject: [PATCH 02/25] ch ch chcnages via @kennethreitz --- docs/_themes/kr/static/flasky.css_t | 4 +++ docs/_themes/kr/static/small_flask.css | 43 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/docs/_themes/kr/static/flasky.css_t b/docs/_themes/kr/static/flasky.css_t index 6610b88c..b7c3a2a2 100644 --- a/docs/_themes/kr/static/flasky.css_t +++ b/docs/_themes/kr/static/flasky.css_t @@ -420,6 +420,10 @@ a:hover tt { width: auto; } + .footer { + width: auto; + } + .bodywrapper { margin: 0; } diff --git a/docs/_themes/kr/static/small_flask.css b/docs/_themes/kr/static/small_flask.css index 1c6df309..0d93b72a 100644 --- a/docs/_themes/kr/static/small_flask.css +++ b/docs/_themes/kr/static/small_flask.css @@ -68,3 +68,46 @@ div.body { min-height: 0; padding: 0; } + +div.sphinxsidebar { + display: none; +} + +div.document { + width: 100%; +} + +div.documentwrapper { + margin-left: 0; + margin-top: 0; + margin-right: 0; + margin-bottom: 0; +} + +div.bodywrapper { + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + margin-left: 0; +} + +ul { + margin-left: 0; +} + +.document { + width: auto; +} + +.footer { + width: auto; +} + +.bodywrapper { + margin: 0; +} + +.footer { + width: auto; +} + From e32840f6319eb1879a4828dc410b50352877fb64 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 2 Nov 2011 20:39:06 -0400 Subject: [PATCH 03/25] fix request docs --- requests/api.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/requests/api.py b/requests/api.py index 34febf25..a139f3d5 100644 --- a/requests/api.py +++ b/requests/api.py @@ -29,6 +29,23 @@ def request(method, url, hooks=None, return_response=True, config=None): + """Constructs and sends a :class:`Request `. + Returns :class:`Response ` object. + + :param method: method for the new :class:`Request` object. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. + :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. + :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload. + :param auth: (optional) Auth typle to enable Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) Float describing the timeout of the request. + :param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed. + :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. + :param return_response: (optional) If False, an un-sent Request object will returned. + :param config: (optional) A configuration dictionary. + """ s = session() return s.request( From eaf1264879d8aebfc160a385889e9e0483810456 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Wed, 2 Nov 2011 23:29:31 -0700 Subject: [PATCH 04/25] Fixes an issue with auth and redirects --- requests/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/requests/models.py b/requests/models.py index fd74ed54..5da414af 100644 --- a/requests/models.py +++ b/requests/models.py @@ -338,6 +338,7 @@ class Request(object): r = auth_func(self, *auth_args) self.__dict__.update(r.__dict__) + self.auth = auth_args # Build the Urllib2 Request. req = _Request(url, data=data, headers=headers, method=self.method) From 3efd5dbab42fb6fe7d4825bbd575d989574c1505 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Thu, 3 Nov 2011 08:05:55 -0700 Subject: [PATCH 05/25] A cleaner and more complete fix for auth/redirects --- requests/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requests/models.py b/requests/models.py index 5da414af..d7ba894c 100644 --- a/requests/models.py +++ b/requests/models.py @@ -96,6 +96,7 @@ class Request(object): self.response = Response() #: Authentication tuple to attach to :class:`Request `. + self._auth = auth self.auth = auth_dispatch(auth) #: CookieJar to attach to :class:`Request `. @@ -237,7 +238,7 @@ class Request(object): method=method, # data=self.data, # params=self.params, - auth=self.auth, + auth=self._auth, cookies=self.cookies, redirect=True, config=self.config @@ -338,7 +339,6 @@ class Request(object): r = auth_func(self, *auth_args) self.__dict__.update(r.__dict__) - self.auth = auth_args # Build the Urllib2 Request. req = _Request(url, data=data, headers=headers, method=self.method) From 80c55f576723d3feed5c8032620dccd2b5bc4d77 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 3 Nov 2011 19:03:11 -0300 Subject: [PATCH 06/25] python-rexster --- docs/community/out-there.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/community/out-there.rst b/docs/community/out-there.rst index b1584423..d8367f2f 100644 --- a/docs/community/out-there.rst +++ b/docs/community/out-there.rst @@ -7,6 +7,7 @@ Modules - `fullerene `_, a Graphite Dashboard. - `urbanairship-python `_, a fork of the Urban Airship API wrapper. - `WhitespaceBot `_, a project that automatically forks repos, strips trailing whitespace, and sends a pull request. +- `python-rexster `_, Rexter client that provides a simple interface for graph databases. Articles & Talks ================ From 8fe6f8c6189e2ace5e2bd09eb2d0f098285cb889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Reni=C3=A9?= Date: Fri, 4 Nov 2011 15:49:29 +0100 Subject: [PATCH 07/25] Fixed a broken link in the docs --- docs/user/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 3adfb7ac..17e503a2 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -164,4 +164,4 @@ Requests supports it!:: ----------------------- -Ready for more? Check out the advanced_ section. \ No newline at end of file +Ready for more? Check out the :ref:`advanced ` section. From 23b0535a0dd5a80f4fd5cde314e2bf287905c33e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 11:51:38 -0300 Subject: [PATCH 08/25] Update AUTHORS --- AUTHORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 8ac10b29..304af323 100644 --- a/AUTHORS +++ b/AUTHORS @@ -47,4 +47,5 @@ Patches and Suggestions - Travis N. Vaught - Fredrik Möllerstrand - Daniel Hengeveld -- Dan Head \ No newline at end of file +- Dan Head +- Bruno Renié \ No newline at end of file From f9bcf7c611781f3ec9237f1872b5ab1be0f8fb71 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 21:59:12 -0400 Subject: [PATCH 09/25] revert --- docs/_themes/kr/static/small_flask.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_themes/kr/static/small_flask.css b/docs/_themes/kr/static/small_flask.css index 0d93b72a..7463266a 100644 --- a/docs/_themes/kr/static/small_flask.css +++ b/docs/_themes/kr/static/small_flask.css @@ -68,7 +68,7 @@ div.body { min-height: 0; padding: 0; } - +/* div.sphinxsidebar { display: none; } @@ -111,3 +111,4 @@ ul { width: auto; } +*/ \ No newline at end of file From a02189a8e93d814faa03fafd4127e928369b76b3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 22:14:12 -0400 Subject: [PATCH 10/25] hide rtd on mobile docs --- docs/_themes/kr/static/small_flask.css | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/_themes/kr/static/small_flask.css b/docs/_themes/kr/static/small_flask.css index 7463266a..b296e4a1 100644 --- a/docs/_themes/kr/static/small_flask.css +++ b/docs/_themes/kr/static/small_flask.css @@ -68,15 +68,20 @@ div.body { min-height: 0; padding: 0; } -/* -div.sphinxsidebar { - display: none; + +.rtd_doc_footer { + display: none; } div.document { width: 100%; } +/* +div.sphinxsidebar { + display: none; +} + div.documentwrapper { margin-left: 0; margin-top: 0; From b3e2410f4430c1933caaee018c288332fdd1082b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 22:15:54 -0400 Subject: [PATCH 11/25] mobile auto width --- docs/_themes/kr/static/small_flask.css | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/_themes/kr/static/small_flask.css b/docs/_themes/kr/static/small_flask.css index b296e4a1..f6321f88 100644 --- a/docs/_themes/kr/static/small_flask.css +++ b/docs/_themes/kr/static/small_flask.css @@ -73,10 +73,11 @@ div.body { display: none; } -div.document { - width: 100%; +.document { + width: auto; } + /* div.sphinxsidebar { display: none; @@ -100,9 +101,7 @@ ul { margin-left: 0; } -.document { - width: auto; -} + .footer { width: auto; From 628325ae90352e09fa5ccee29211ddeb2955d199 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 22:58:43 -0400 Subject: [PATCH 12/25] =?UTF-8?q?Official=E2=84=A2=20mobile-friendly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/_themes/kr/layout.html | 8 +++-- docs/_themes/kr/static/flasky.css_t | 8 +++-- docs/_themes/kr/static/small_flask.css | 46 +++++--------------------- 3 files changed, 19 insertions(+), 43 deletions(-) diff --git a/docs/_themes/kr/layout.html b/docs/_themes/kr/layout.html index 623e3ef0..54221a9c 100644 --- a/docs/_themes/kr/layout.html +++ b/docs/_themes/kr/layout.html @@ -2,18 +2,20 @@ {%- block extrahead %} {{ super() }} {% if theme_touch_icon %} - + {% endif %} + + {% endblock %} {%- block relbar2 %}{% endblock %} {%- block footer %} - - Fork me on GitHub + + Fork me on GitHub {% endblock %} {%- block relbar2 %}{% endblock %} From f7968b6797a50716a2f177ad23439a3c6bb9f683 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 23:24:38 -0400 Subject: [PATCH 14/25] r.content is None of there's an invalid response. Fixes #236 --- requests/models.py | 6 +++++- test_requests.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/requests/models.py b/requests/models.py index fd74ed54..9ad9e67f 100644 --- a/requests/models.py +++ b/requests/models.py @@ -496,7 +496,11 @@ class Response(object): 'already consumed') # Read the contents. - self._content = self.raw.read() + try: + self._content = self.raw.read() + except AttributeError: + return None + # Decode GZip'd content. if 'gzip' in self.headers.get('content-encoding', ''): diff --git a/test_requests.py b/test_requests.py index e68493e1..ebff33dd 100755 --- a/test_requests.py +++ b/test_requests.py @@ -529,6 +529,11 @@ class RequestsTestSuite(unittest.TestCase): assert params3['b'] in r3.content assert params3['c'] in r3.content + def test_invalid_content(self): + + r = requests.get('http://somedomainthatclearlydoesntexistg.com') + assert r.content == None + if __name__ == '__main__': unittest.main() From 2bae57e0a6c764b1b28b3bbb1b3b0cd1cc9b4f14 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 23:26:31 -0400 Subject: [PATCH 15/25] v0.7.5 --- HISTORY.rst | 5 +++++ requests/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index b32181e8..c23ead2a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,11 @@ History ------- +0.7.5 (2001-11-04) +++++++++++++++++++ + +* Response.content = None if there was an invalid repsonse. + 0.7.4 (2011-10-26) ++++++++++++++++++ diff --git a/requests/__init__.py b/requests/__init__.py index cd7d9d72..6699ac51 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -15,8 +15,8 @@ requests """ __title__ = 'requests' -__version__ = '0.7.4' -__build__ = 0x000704 +__version__ = '0.7.5' +__build__ = 0x000705 __author__ = 'Kenneth Reitz' __license__ = 'ISC' __copyright__ = 'Copyright 2011 Kenneth Reitz' From 72c8163aee29320a1d3ffd3818b7ee0c10f0d724 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 23:27:50 -0400 Subject: [PATCH 16/25] davidfischer --- AUTHORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 304af323..131c0f61 100644 --- a/AUTHORS +++ b/AUTHORS @@ -48,4 +48,5 @@ Patches and Suggestions - Fredrik Möllerstrand - Daniel Hengeveld - Dan Head -- Bruno Renié \ No newline at end of file +- Bruno Renié +- David Fischer \ No newline at end of file From cf36d8c7538b2b04adbfea933398f890cd9a85d9 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 23:32:15 -0400 Subject: [PATCH 17/25] changes! --- HISTORY.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.rst b/HISTORY.rst index c23ead2a..298140b6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,7 @@ History ++++++++++++++++++ * Response.content = None if there was an invalid repsonse. +* Redirection auth handling. 0.7.4 (2011-10-26) ++++++++++++++++++ From 33ee7320822fae90e6a90c2c7241bd6412b68f66 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 4 Nov 2011 23:57:43 -0400 Subject: [PATCH 18/25] steal @shazow's contribute paragraph --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index b1919d37..d5a323b2 100644 --- a/README.rst +++ b/README.rst @@ -93,8 +93,10 @@ But, you really shouldn't do that. Contribute ---------- -If you'd like to contribute, simply fork `the repository`_, commit your changes to the **develop** branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS_. - +#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a Contributor Friendly tag for issues that should be ideal for people who are not very familiar with the codebase yet. +#. Fork `the repository`_ on Github to start making your changes to the **develop** branch (or branch off of it). +#. Write a test which shows that the bug was fixed or that the feature works as expected. +#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. .. _`the repository`: http://github.com/kennethreitz/requests .. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS From 04cdd0f2e70f8e9254ec306ed6d34fe55f7f382f Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 6 Nov 2011 13:24:23 -0500 Subject: [PATCH 19/25] daikon --- docs/community/out-there.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/community/out-there.rst b/docs/community/out-there.rst index d8367f2f..933c397f 100644 --- a/docs/community/out-there.rst +++ b/docs/community/out-there.rst @@ -8,6 +8,7 @@ Modules - `urbanairship-python `_, a fork of the Urban Airship API wrapper. - `WhitespaceBot `_, a project that automatically forks repos, strips trailing whitespace, and sends a pull request. - `python-rexster `_, Rexter client that provides a simple interface for graph databases. +- `daikon `_, a CLI for ElasticSearch. Articles & Talks ================ From 7ce305fa8927f22501b061261c0ce57775ed9006 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 6 Nov 2011 13:25:34 -0500 Subject: [PATCH 20/25] french post --- docs/community/out-there.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/community/out-there.rst b/docs/community/out-there.rst index 933c397f..7870de9e 100644 --- a/docs/community/out-there.rst +++ b/docs/community/out-there.rst @@ -18,6 +18,7 @@ Articles & Talks - `Issac Kelly's 'Consuming Web APIs' talk `_ - `Blog post about Requests via Yum `_ - `Russian blog post introducing Requests `_ +- `French blog post introducing Requests `_ Integrations From daa4fbf4e2111c0c7c7c4a7deb9130f81ec1d326 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 6 Nov 2011 21:57:47 -0600 Subject: [PATCH 21/25] Updated your 2001, to 2011... unless you went back in time ;) --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 298140b6..156b764c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,7 +1,7 @@ History ------- -0.7.5 (2001-11-04) +0.7.5 (2011-11-04) ++++++++++++++++++ * Response.content = None if there was an invalid repsonse. From 9c3ca6e740e3f93da9ddccb20d81210772c4e07c Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 7 Nov 2011 10:42:10 -0500 Subject: [PATCH 22/25] The Washington Post --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 44a62517..73da870c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -39,7 +39,7 @@ all the hard work and crazy hacks for you. Testimonials ------------ -`Twitter, Inc `_, +`The Washington Post `_, `Twitter, Inc `_, a U.S. Federal Institution, NIH, `Readability `_, and From 12fa108edeeb876d6a5f2a407ebe64dd7ae8339e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 7 Nov 2011 14:18:05 -0500 Subject: [PATCH 23/25] add query data to digest path --- requests/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requests/auth.py b/requests/auth.py index b87bfd07..aabeb866 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -67,7 +67,8 @@ def http_digest(r, username, password): # XXX not implemented yet entdig = None - path = urlparse(r.request.url).path + p_parsed = urlparse(r.request.url) + path = p_parsed.path + p_parsed.query A1 = "%s:%s:%s" % (username, realm, password) A2 = "%s:%s" % (r.request.method, path) From 8c90c610cd15f91ed0cd1738aa73f088496b6af9 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 7 Nov 2011 14:20:32 -0500 Subject: [PATCH 24/25] v0.7.6 Fixes #237 --- HISTORY.rst | 5 +++++ requests/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 156b764c..36d47f7c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,11 @@ History ------- +0.7.6 (2011-11-07) +++++++++++++++++++ + +* Digest authentication bugfix (attach query data to path) + 0.7.5 (2011-11-04) ++++++++++++++++++ diff --git a/requests/__init__.py b/requests/__init__.py index 6699ac51..1140a523 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -15,8 +15,8 @@ requests """ __title__ = 'requests' -__version__ = '0.7.5' -__build__ = 0x000705 +__version__ = '0.7.6' +__build__ = 0x000706 __author__ = 'Kenneth Reitz' __license__ = 'ISC' __copyright__ = 'Copyright 2011 Kenneth Reitz' From f5bbb9714d66103280d0ca10742877f4522787ff Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 9 Nov 2011 10:24:41 -0500 Subject: [PATCH 25/25] Note about terrible DNS providers for testing --- test_requests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test_requests.py b/test_requests.py index ebff33dd..d5c9eaa1 100755 --- a/test_requests.py +++ b/test_requests.py @@ -531,7 +531,10 @@ class RequestsTestSuite(unittest.TestCase): def test_invalid_content(self): - r = requests.get('http://somedomainthatclearlydoesntexistg.com') + # WARNING: if you're using a terrible DNS provider (comcast), + # this will fail. + r = requests.get('http://somedomainthatclearlydoesntexistg.com', allow_redirects=False) + assert r.content == None