def score_http_xml(self, data): """This function should be used as the callback for the HTTP server when the data is expected to be XML.""" wrapper = StringIO(data) #wrap the data in a StringIO object rdr = Reader(self.score, source = wrapper, logger = self.logger, magicheader = False, unitable = False) pipe = rdr.new_pipe() #try: return rdr.feed_pipe(None, pipe)
def score_http_uni(self,data): """This function should be used as the callback for the HTTP server when the data is expected to be a UniTable or csv file.""" wrapper = StringIO(data) #wrap the data in a StringIO object rdr = Reader(self.score, source = wrapper, logger = self.logger, magicheader = False, unitable = True) pipe = rdr.new_pipe() try: return rdr.feed_pipe(None, pipe) except: self.logger.error("something broke.") pass
def http_callback(data): wrapper = StringIO.StringIO(data) rdr =\ Reader(callback, source=wrapper, logger=self._logger, magicheader=False, unitable=not isXML, wholeUniTable=not isXML) pipe = rdr.new_pipe() try: result = rdr.feed_pipe(None, pipe) except: raise IOError("Problem reading data over HTTP.") return result