facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.28k stars 631 forks source link

bugfix: error_data statement when null #562

Closed crazyministr closed 4 years ago

crazyministr commented 4 years ago

I've got an error during request to create adset. The error reason doesn't match with pull request changes but there is another problem.

  1. 'error_data': 'null',
  2. json.loads('null') returns NoneType object
  3. error_data.get('blame_field_specs') throws an exception AttributeError: 'NoneType' object has no attribute 'get'
    {
    'message': 'Invalid parameter', 
    'type': 'OAuthException', 
    'code': 100, 
    'error_data': 'null', 
    'error_subcode': 1487079, 
    'is_transient': False, 
    'error_user_title': 'Invalid targeting spec', 
    'error_user_msg': 'The specified targeting spec is not valid because: The field audience_positions is not a valid target spec field', 
    'fbtrace_id': 'Ai7361tVWYjx2dvScd15MG9'
    }