facebook-python-business-sdk icon indicating copy to clipboard operation
facebook-python-business-sdk copied to clipboard

Fix for TypeError in ObjectParser

Open ekoly opened this issue 7 years ago • 1 comments

see https://github.com/facebook/facebook-python-ads-sdk/issues/250

There have been several issues related to data and results in ObjectParser.parse_single() being type string or list but containing one of the keys, which causes a TypeError. For example, 'my_images' would evaluate to True for 'images' in data on line 63, but the following line data = data['images'] doesn't make sense if it is a string.

This pull request would fix the issue by wrapping the if statements in a typecheck making sure data is a dict.

ekoly avatar Sep 07 '16 20:09 ekoly

What needs to happen to get this PR or something like it checked in? The APIs occasionally error ("Sorry, something went wrong") and the SDK doesn't handle this well at all. A different approach would be to detect this at the request level before even calling the parser.

rafaelrruiz avatar Mar 31 '19 04:03 rafaelrruiz