def text_processor(text): genre = 'Cannot process request. Service is unreachable.' try: connect = ServerProxy("http://127.0.0.1:8001") genre = connect.classify_text(text) except Exception as e: genre += e return genre
__author__ = 'Oleksandr Korobov' # XmlRpc client code example from xmlrpclib import ServerProxy connect = ServerProxy("http://localhost:8001") print 'Known genre are:', connect.get_genres_list() print 'Your genre is: ', connect.classify_text('Put your english text here...')