Skip to content

Instantly share code, notes, and snippets.

import sys, json
class External(object):
def run(self):
line = sys.stdin.readline()
while line:
try:
response = self.process(json.loads(line.decode('utf_8')))
except Exception, e:
response = {'code':500, 'json':{'error':True, 'reason':"Internal error processing request (%s)" % e}}