4 Feb 2013 sness   » (Journeyer)

Python Diary | Good use for the Http-Accept header?

Python Diary | Good use for the Http-Accept header?: "While working on a project which needs to use JSON for AJAX functions, I thought about using the Http-Accept header to return content depending on what the client asks. Most web browsers send this header, and it is usually on the lines of, I accept anything in the XML mimetypes, including HTML. Since headers can be set from jQuery and various client software, I thought... Why not take advantage of this Http-Accept header and build a Django middleware to return the content which is accepted by the client. So far, it only detects and returns JSON, and there is no caching enabled. Keep in mind that this is my very first version of this middleware, which I did test and works as expected."

'via Blog this'

Syndicated 2013-02-04 05:25:00 from sness

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!