explicitly setting "pretty print" formatting for Graph API request
When querying the Graph API with a 'known' browser the JSON output is formatted in a way to make it easy for humans to read. If the query is done with any other browser then it outputs everything on one line.
How do you explicitly make the request so that the formatting is not done? I'm sure I've seen 开发者_如何学Pythonit somewhere, but I can't seem to find it now.
The pretty
parameter controls it. So https://graph.facebook.com/foo?pretty=0
always prints without extra whitespace, while https://graph.facebook.com/foo?pretty=1
always prints with extra whitespace, and omitting it causes the default behavior of switching based on user-agent.
精彩评论