From aa31b6b4dd199ba733b5e03226a8019a2b9c7c66 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 13 Oct 2011 22:02:46 -0400 Subject: [PATCH] Merge fixes --- requests/api.py | 11 +---------- requests/models.py | 5 ----- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/requests/api.py b/requests/api.py index 54aeff88..ab388ed7 100644 --- a/requests/api.py +++ b/requests/api.py @@ -112,13 +112,9 @@ def get(url, **kwargs): :param **kwargs: Optional arguments that ``request`` takes. """ - return request('GET', url, **kwargs) + kwargs.setdefault('allow_redirects', True) return request('GET', url, **kwargs) - if "allow_redirects" not in kwargs: - kwargs["allow_redirects"] = True - - return request('get', url, **kwargs) def head(url, **kwargs): @@ -141,13 +137,8 @@ def head(url, **kwargs): :param **kwargs: Optional arguments that ``request`` takes. """ - return request('HEAD', url, **kwargs) kwargs.setdefault('allow_redirects', True) return request('HEAD', url, **kwargs) - if "allow_redirects" not in kwargs: - kwargs["allow_redirects"] = True - - return request('head', url, **kwargs) def post(url, data='', **kwargs): diff --git a/requests/models.py b/requests/models.py index 4a304a50..bf564b8c 100644 --- a/requests/models.py +++ b/requests/models.py @@ -214,12 +214,7 @@ class Request(object): while ( ('location' in r.headers) and - ((self.method in ('GET', 'HEAD')) or - (r.status_code is codes.see_other) or - (self.allow_redirects)) ((r.status_code is codes.see_other) or (self.allow_redirects)) - ((r.status_code is codes.see_other) or - (self.allow_redirects)) ): r.fo.close()