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

Detect all HTTP errors in FacebookResponse #552

Closed s-nez closed 1 year ago

s-nez commented 4 years ago

With the current implementation, any error response with a non-empty body will be considered a success unless it contains the string "Service Unavailable". This includes, for example, a 502 Bad Gateway response with an HTML body, causing other code to consider the call a success and fail when trying to treat the HTML response as a dict.

This change makes sure HTTP errors are never considered successful requests.