def __init__(self, file_name=None, parser_library=None, **keywords): self.__file_name = file_name if "force_file_type" in keywords: file_type = keywords.get("force_file_type") else: file_type = self.__file_name.split(".")[-1] self.__parser = PARSER.get_a_plugin(file_type, parser_library) AbstractSource.__init__(self, **keywords)
def get_data(self): aparser = PARSER.get_a_plugin(self._db_type, self.__parser_library) export_params = self.get_export_params() data = aparser.parse_file_stream( export_params, export_columns_list=[self.__export_columns], **self._keywords) if self.__sheet_name is not None: _set_dictionary_key(data, self.__sheet_name) return data
def __init__(self, file_content=None, file_type=None, file_stream=None, **keywords): self.__file_type = file_type self.__file_stream = file_stream self.__file_content = file_content self.__parser = PARSER.get_a_plugin(file_type) InputSource.__init__(self, **keywords)
def __init__(self, file_content=None, file_type=None, file_stream=None, parser_library=None, **keywords): self.__file_type = file_type self.__file_stream = file_stream self.__file_content = file_content self.__parser = PARSER.get_a_plugin(file_type, parser_library) AbstractSource.__init__(self, **keywords)
def get_data(self): connection = request.urlopen(self.__url) info = connection.info() if PY2: mime_type = info.type else: mime_type = info.get_content_type() file_type = FILE_TYPE_MIME_TABLE.get(mime_type, None) if file_type is None: file_type = _get_file_type_from_url(self.__url) parser_library = self._keywords.get("parser_library", None) aparser = PARSER.get_a_plugin(file_type, parser_library) sheets = aparser.parse_file_stream(connection, **self._keywords) return sheets
def get_data(self): connection = request.urlopen(self.__url) info = connection.info() if PY2: mime_type = info.type else: mime_type = info.get_content_type() file_type = FILE_TYPE_MIME_TABLE.get(mime_type, None) if file_type is None: file_type = _get_file_type_from_url(self.__url) parser_library = self._keywords.get('parser_library', None) aparser = PARSER.get_a_plugin(file_type, parser_library) sheets = aparser.parse_file_stream(connection, **self._keywords) return sheets
def get_data(self): aparser = PARSER.get_a_plugin(self.__db_type, self.__parser_library) export_params = self.get_params() data = aparser.parse_file_stream(export_params, **self._keywords) return data
def __init__(self, file_name=None, **keywords): self.__file_name = file_name file_type = self.__file_name.split('.')[-1] self.__parser = PARSER.get_a_plugin(file_type) InputSource.__init__(self, **keywords)
def __init__(self, file_name=None, parser_library=None, **keywords): self.__file_name = file_name file_type = self.__file_name.split('.')[-1] self.__parser = PARSER.get_a_plugin(file_type, parser_library) AbstractSource.__init__(self, **keywords)