<s> import random <EOL> from lightsocket . server import Resource , Response , Router <EOL> class ExampleProxy ( Resource ) : <EOL> def __init__ ( self ) : <EOL> self . router = Router ( self ) <EOL> self . method_map = dict ( yep = self . yep ) <EOL> def handle_request ( self , request ) : <EOL> method = self . get_method ( request ) <EOL> return method ( request ) <EOL> def yep ( self , request ) : <EOL> data = "<STR_LIT>" + str ( random . random ( ) ) <EOL> return Response ( <NUM_LIT:200> , data ) <EOL> class Example ( Resource ) : <EOL> def __init__ ( self ) : <EOL> self . router = Router ( self ) <EOL> self . router . add ( "<STR_LIT>" , ExampleProxy ( ) ) <EOL> self . method_map = dict ( test = self . test ) <EOL> def handle_request ( self , request ) : <EOL> method = self . get_method ( request ) <EOL> return method ( request ) <EOL> def shutdown ( self , params ) : <EOL> return Response ( <NUM_LIT:200> , None ) <EOL> def test ( self , request ) : <EOL> data = "<STR_LIT>" + str ( random . random ( ) ) <EOL> return Response ( <NUM_LIT:200> , data ) </s>
