]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Avoid raising a KeyError when there's no session expiration date
authorAlberto García Hierro <alberto@garciahierro.com>
Mon, 13 Sep 2010 18:09:40 +0000 (20:09 +0200)
committerAlberto García Hierro <alberto@garciahierro.com>
Mon, 13 Sep 2010 18:28:30 +0000 (20:28 +0200)
It happens when the token is requested with the 'offline_access'
extended permission.

tornado/auth.py

index d77e5c479cd0a6e277afc9cdcc3a24d7e5c9a72e..dd9b6202b01f5ced7d9f58045dba265837b193be 100644 (file)
@@ -963,7 +963,7 @@ class FacebookGraphMixin(OAuth2Mixin):
                         callback, response):
       session = {
       "access_token": cgi.parse_qs(response.body)["access_token"][-1],
-      "expires": cgi.parse_qs(response.body)["expires"]
+      "expires": cgi.parse_qs(response.body).get("expires")
       }
 
       self.facebook_request(