TypeError in ObjectParser
After a certain call to AdAccount.get_insights() resulted in the following:
File "facebookads/api.py", line 663, in execute
return self._response_parser.parse_single(response.json())
File "facebookads/adobjects/objectparser.py", line 64, in parse_single
_, data = data['images'].popitem()
TypeError: string indices must be integers
It appears to be an isolated incident that I haven't been able to reproduce.
There have been other issues raised regarding data being an invalid type in this block. I'd suggest wrapping the entire thing in a check such as: if isinstance(data['results'], dict)
Pull request at https://github.com/facebook/facebook-python-ads-sdk/pull/251
I've also run into this bug.
I'm not sure exactly whether it's the same bug but here's the traceback for reference:
TypeError: string indices must be integers
at _set_data (/env/local/lib/python2.7/site-packages/facebookads/adobjects/helpers/adimagemixin.py:91)
at create_object (/env/local/lib/python2.7/site-packages/facebookads/adobjects/abstractobject.py:167)
at parse_multiple (/env/local/lib/python2.7/site-packages/facebookads/adobjects/objectparser.py:96)
at build_objects_from_response (/env/local/lib/python2.7/site-packages/facebookads/api.py:822)
at load_next_page (/env/local/lib/python2.7/site-packages/facebookads/api.py:813)
at __next__ (/env/local/lib/python2.7/site-packages/facebookads/api.py:763)
When this issue would be fixed? Also encountering the same problem.
Hi, it seems like this issue has been open for quite a while now. We have made many changes in the SDK since then, including releasing a new version. If you can repro your specific issue with the latest version of the SDK, please create a new issue or comment here with further details.