4 ms·
Hadn't thought of that. Done. I may revise if it increases server load significantly but it looks good for now: http://www.heyzap.com/api/v1/activity/android h
by immad 15y ago
Hadn't thought of that. Done.
I may revise if it increases server load significantly but it looks good for now: http://www.heyzap.com/api/v1/activity/android http://www.heyzap.com/api/v1/activity/android
- cellularmitosis 15y agoPerhaps this would be a good place to tie into the "Accept:" request header? If it says text/html in Accept:, you're still going to return JSON, but you can use this as a hint that it is probably being read by a human, and you can pretty print it. But if you see application/json in Accept:, then you assume it's an API call from a phone or script and you minify it instead. Edit: however, that requires cooperation from others, so is prone to failure. Perhaps also take hints from the user agent string? Edit 2: drat, someone already beat me to this suggestion. However, I'll use this as an excuse to pimp my last weekend hack: adding an Accept: decorator to itty.py http://news.ycombinator.com/item?id=3665743 http://news.ycombinator.com/item?id=3665743