facebook-python-business-sdk
facebook-python-business-sdk copied to clipboard
Fix for TypeError in ObjectParser
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.
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.