<s> from jsonrpclib import Server <EOL> from . import FSQPushError , FSQRemoteTriggerError , constants as _c <EOL> def push ( item , remote_addr , trg_queue , protocol = u'<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> if protocol == u'<STR_LIT>' : <EOL> try : <EOL> server = Server ( remote_addr , encoding = _c . FSQ_CHARSET ) <EOL> return server . enqueue ( item . id , trg_queue , item . item . read ( ) ) <EOL> except Exception , e : <EOL> raise FSQPushError ( e ) <EOL> raise ValueError ( '<STR_LIT>' . format ( protocol ) ) <EOL> def remote_trigger_pull ( remote_addr , trg_queue , ignore_listener = False , <EOL> protocol = u'<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> if protocol == u'<STR_LIT>' : <EOL> try : <EOL> server = Server ( remote_addr , encoding = _c . FSQ_CHARSET ) <EOL> return server . trigger_pull ( queue = trg_queue , <EOL> ignore_listener = ignore_listener , <EOL> trigger = _c . FSQ_TRIGGER ) <EOL> except Exception , e : <EOL> raise FSQRemoteTriggerError ( e ) <EOL> raise ValueError ( '<STR_LIT>' . format ( protocol ) ) </s>
