<s> from flask import Flask , request <EOL> from wsgi_jsonrpc . json_tools import ServerProxy <EOL> from uuid import uuid4 <EOL> from json import dumps <EOL> app = Flask ( __name__ ) <EOL> @ app . route ( "<STR_LIT>" ) <EOL> def create_client ( ) : <EOL> shaveet = ServerProxy ( "<STR_LIT>" ) <EOL> client_id = request . args . get ( '<STR_LIT:name>' ) + "<STR_LIT:_>" + str ( uuid4 ( ) ) . replace ( "<STR_LIT:->" , "<STR_LIT>" ) + '<STR_LIT>' ; <EOL> key = shaveet . create_client ( client_id ) [ '<STR_LIT:result>' ] <EOL> shaveet . subscribe ( client_id , '<STR_LIT>' ) <EOL> return dumps ( { '<STR_LIT:key>' : key , '<STR_LIT>' : client_id } ) <EOL> @ app . route ( "<STR_LIT>" ) <EOL> def new_message ( ) : <EOL> shaveet = ServerProxy ( "<STR_LIT>" ) <EOL> shaveet . new_message ( request . args . get ( '<STR_LIT>' ) , request . args . get ( '<STR_LIT>' ) , '<STR_LIT>' , False ) ; <EOL> return "<STR_LIT:1>" <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> app . debug = True <EOL> app . run ( host = '<STR_LIT>' ) </s>
