Prevent a KeyError when there's no link headers
authorIan Cordasco <graffatcolmingov@gmail.com>
Thu, 9 May 2013 03:26:49 +0000 (23:26 -0400)
committerIan Cordasco <graffatcolmingov@gmail.com>
Thu, 9 May 2013 03:26:49 +0000 (23:26 -0400)
requests/models.py

index 49c6364c94f504c264853ec80d80cf67a289ec6c..9467a56a3e08c24a2811e61b44bdfbcc93fa1334 100644 (file)
@@ -646,7 +646,7 @@ class Response(object):
     def links(self):
         """Returns the parsed header links of the response, if any."""
 
-        header = self.headers['link']
+        header = self.headers.get('link')
 
         # l = MultiDict()
         l = {}