<s> """<STR_LIT>""" <EOL> import win32serviceutil <EOL> import win32service <EOL> import cherrypy <EOL> import os <EOL> from rfid import ten_digit_to_comma_format , RFIDClient <EOL> ip_address = '<STR_LIT>' <EOL> controller_serial = <NUM_LIT> <EOL> client = RFIDClient ( ip_address , controller_serial ) <EOL> class RootServer : <EOL> @ cherrypy . expose <EOL> def index ( self , apiKey = None , action = None , badge = None ) : <EOL> if ( apiKey == "<STR_LIT>" ) : <EOL> if badge : <EOL> badge = ten_digit_to_comma_format ( int ( badge ) ) <EOL> if ( action == "<STR_LIT>" ) : <EOL> try : <EOL> client . remove_user ( badge ) <EOL> return "<STR_LIT>" <EOL> except : <EOL> return "<STR_LIT>" <EOL> elif ( action == "<STR_LIT>" ) : <EOL> try : <EOL> client . add_user ( badge , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> return "<STR_LIT>" <EOL> except : <EOL> return "<STR_LIT>" <EOL> else : <EOL> return "<STR_LIT>" <EOL> else : <EOL> return "<STR_LIT>" <EOL> else : <EOL> return "<STR_LIT>" <EOL> class MyService ( win32serviceutil . ServiceFramework ) : <EOL> """<STR_LIT>""" <EOL> _svc_name_ = "<STR_LIT>" <EOL> _svc_display_name_ = "<STR_LIT>" <EOL> def SvcDoRun ( self ) : <EOL> cherrypy . tree . mount ( RootServer ( ) , '<STR_LIT>' ) <EOL> cherrypy . config . update ( { <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( "<STR_LIT>" ) } <EOL> } ) <EOL> cherrypy . engine . start ( ) <EOL> cherrypy . engine . block ( ) <EOL> def SvcStop ( self ) : <EOL> self . ReportServiceStatus ( win32service . SERVICE_STOP_PENDING ) <EOL> cherrypy . engine . exit ( ) <EOL> self . ReportServiceStatus ( win32service . SERVICE_STOPPED ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> win32serviceutil . HandleCommandLine ( MyService ) </s>
