Thanks to @maxcountryman for the code review
authorIan Cordasco <graffatcolmingov@gmail.com>
Wed, 30 Jan 2013 15:58:32 +0000 (10:58 -0500)
committerIan Cordasco <graffatcolmingov@gmail.com>
Wed, 30 Jan 2013 15:58:32 +0000 (10:58 -0500)
requests/sessions.py

index c2eebac..633d138 100644 (file)
@@ -367,12 +367,8 @@ class Session(SessionRedirectMixin):
         """Send a given PreparedRequest."""
         # Set up variables needed for resolve_redirects and dispatching of
         # hooks
-        allow_redirects = True
-        if 'allow_redirects' in kwargs:
-            allow_redirects = kwargs.pop('allow_redirects')
-        req = None
-        if 'req' in kwargs:
-            req = kwargs.pop('req')
+        allow_redirects = kwargs.pop('allow_redirects', True)
+        req = kwargs.pop('req', None)
         stream = kwargs.get('stream', False)
         timeout = kwargs.get('timeout')
         verify = kwargs.get('verify')