Revision: 47915
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 18, 2011 03:28 by alejandrombernardis
Initial Code
import tornado.escape # or simplejson, etc import urllib class SimpleRequest(object): def __init__(self, path, args={}, post_args=None): self._path = path self._args = args self._post_data = post_args def read(self): post_data = None if self._post_data is not None: post_data = urllib.urlencode(self._post_data) path = "%s?%s" % (self._path, urllib.urlencode(self._args)) request = urllib.urlopen(path, post_data) try: response = tornado.escape.json_decode(request.read()) except: return False, -1 finally: request.close() return True, response @staticmethod def response(self, path, args={}, post_args=None): return SimpleRequest(path, args, post_args).read()
Initial URL
http://www.alejandrob.com.ar/
Initial Description
Initial Title
Py | SimpleRequest
Initial Tags
python
Initial Language
Python