From 07af2bf27bb1b040bdd99a604207e9f25b871eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilo=20L=C3=B3pez?= Date: Fri, 7 Aug 2015 14:58:48 -0300 Subject: [PATCH 1/2] Add get to parsed_response to type field I'm getting a facebook error without type key on parsed_respose['error'], so adding get instead of directly asking to key. --- open_facebook/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/open_facebook/api.py b/open_facebook/api.py index ac4b2f78..6d96e0e4 100644 --- a/open_facebook/api.py +++ b/open_facebook/api.py @@ -236,7 +236,7 @@ def _request(cls, url, post_data=None, timeout=REQUEST_TIMEOUT, if parsed_response and isinstance(parsed_response, dict): # of course we have two different syntaxes if parsed_response.get('error'): - cls.raise_error(parsed_response['error']['type'], + cls.raise_error(parsed_response['error'].get('type'), parsed_response['error']['message'], parsed_response['error'].get('code')) elif parsed_response.get('error_code'): From 1309100bd14f0714f510e5e853c89908ac4a5e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilo=20L=C3=B3pez?= Date: Fri, 7 Aug 2015 16:01:25 -0300 Subject: [PATCH 2/2] adding default value to get('type') --- open_facebook/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/open_facebook/api.py b/open_facebook/api.py index 6d96e0e4..d0d593b0 100644 --- a/open_facebook/api.py +++ b/open_facebook/api.py @@ -236,7 +236,7 @@ def _request(cls, url, post_data=None, timeout=REQUEST_TIMEOUT, if parsed_response and isinstance(parsed_response, dict): # of course we have two different syntaxes if parsed_response.get('error'): - cls.raise_error(parsed_response['error'].get('type'), + cls.raise_error(parsed_response['error'].get('type', 'no-type-defined'), parsed_response['error']['message'], parsed_response['error'].get('code')) elif parsed_response.get('error_code'):