def get_wiki_summary(title): summary = None f = WikiwareFetch() html = f.fetch_api_parse(title=title, section="0") if html: p = WikiwareAPIParseSummary(content=html) summary = p.get_summary() return summary
def get_wiki_summary(title): """ Get the summary for a geography section of a wiki page """ summary = None f = WikiwareFetch() html = f.fetch_api_parse(title=title, section="0") if html: p = WikiwareAPIParseSummary(content=html) if p.is_category(defaults.WIKIWARE_CATEGORY_TYPE_GEOGRAPHY): p.set_attr(attr={'id': pattern_coordinates}) summary = p.get_summary() return summary
def get_wiki_summary(title): """ Get the summary for a geography section of a wiki page """ summary = None f = WikiwareFetch() html = f.fetch_api_parse(title=title, section="0") if html: p = WikiwareAPIParseSummary(content=html) if p.is_category(defaults.WIKIWARE_CATEGORY_TYPE_GEOGRAPHY): p.set_attr(attr={"id": pattern_coordinates}) summary = p.get_summary() return summary
from fetcher import WikiwareFetch from parser import WikiwareAPIParse if __name__ == '__main__': title = 'France' format = 'json' fetcher = WikiwareFetch() content = fetcher.fetch_api(title=title, format=format) parser = WikiwareAPIParse(content=content, format=format) text = parser.parse() print "\n\n" print text print "\n\n"