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

Add x-app-usage response headers to result

Open lendrom opened this issue 7 years ago • 3 comments

Add x-app-usage response headers to GraphAPI request result Facebook API returns x-app-usage header which contains json with percentage usage of the api for various metrics. It would be handy to have access to that data when using this facebook-sdk. My simple pr just checks for the header in fb api response and adds it to the result returned by GraphAPI instance if available.

FB docs: https://developers.facebook.com/docs/graph-api/advanced/rate-limiting It was also reported here: https://github.com/mobolic/facebook-sdk/issues/314

lendrom avatar Jul 25 '18 11:07 lendrom

I've also made changes to the CircleCI configuration so that the automated tests won't automatically fail.

martey avatar Jul 25 '18 15:07 martey

I can add some tests, but I can see the tests are running on the actual FB API. Wouldn't it be better to run them on a mocked version of it or use something like pyvcr? Now I can reach my app's limits just by running the tests.

lendrom avatar Aug 02 '18 11:08 lendrom

Would it make more sense to just return all headers? This would negate the need to add more code if Facebook adds more useful headers (e.g. X-Page-Usage, etc.).

martey avatar Jan 13 '19 03:01 martey