Skip to content

Instantly share code, notes, and snippets.

View siteshen's full-sized avatar

siteshen siteshen

View GitHub Profile
@siteshen
siteshen / jsend_tornado.py
Created September 18, 2013 16:49
A Mixin for Tornado and JSend specification. Django version: https://gist.github.com/siteshen/7688169
class JSendMixin(object):
"""http://labs.omniti.com/labs/jsend
JSend is a specification that lays down some rules for how JSON
responses from web servers should be formatted.
JSend focuses on application-level (as opposed to protocol- or
transport-level) messaging which makes it ideal for use in
REST-style applications and APIs.
"""
@siteshen
siteshen / url_fetcher.py
Last active August 22, 2021 02:41
A simple multi-threaded URL fetcher.
import urllib2
from Queue import Queue
from threading import Thread
# global var
remaind_urls = Queue()
fetched_urls = set()