Tornado – Escape – URLs

Like that for JSON strings, Tornado also provides methods for escaping and unescaping URLs. Not just that, it also exports some methods to play with URLs. Let's see the behavior with the example below https://gist.github.com/3487940 1. tornado.escape.linkify(text) - creates a link for provided text 2. tornado.escape.linkify(text, shorten=Tue) - creates a link and shortens the URL … Continue reading Tornado – Escape – URLs

Tornado – Escape – Json

Tornado web server exports methods for escape/unescape html, xml, Json among others. This blog discusses about encoding and decoding JSON format. Tornado has the following methods: tornado.escape.json_encode(value) - JSON'ify the Python object passed to it as argument tornado.escape.json_decode(value) - Converts the JSON string into Python Object Here's a usage example: https://gist.github.com/3478215 In this example, 1. … Continue reading Tornado – Escape – Json

Tornado – Web Sockets

  WebSocket (RFC 6455) protocol provides bi-directional (or duplex) communication between web server and browser. Communication typically happens over a single TCP connection and is used to facilitate interaction between web server and browser like live streaming and real time content delivery. It is crucial to note that WebSocket is non standard HTTP connection where … Continue reading Tornado – Web Sockets

Tornado – Blocking & Non-Blocking HTTP Client

Tornado provides tornado.httpclient that works as httpclient and can send blocking and non-blocking (async) http requests. tornado.httpclient.HTTPClient 1. HTTPClient: This tornado client is typically used for testing web servers or simply making a HTTP request and receiving the response. An example implementation below https://gist.github.com/3394444 tornado.httpclient.AsyncHTTPClient 2. AsyncHTTPClient: httpclient.AsyncHTTPClient()  creates an instance of the class and … Continue reading Tornado – Blocking & Non-Blocking HTTP Client