From e484c6d05a34d697c076f95210ec518c3a94d171 Mon Sep 17 00:00:00 2001 From: Kamo Petrosyan Date: Mon, 31 Aug 2015 21:47:21 +0600 Subject: [PATCH] 0.3.8 write_txt added --- pysitemap/crawler.py | 10 ++++++++++ setup.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pysitemap/crawler.py b/pysitemap/crawler.py index 09e5dcf..6608dfa 100644 --- a/pysitemap/crawler.py +++ b/pysitemap/crawler.py @@ -56,6 +56,8 @@ class Crawler: self.parse() if self.oformat == 'xml': self.write_xml() + elif self.oformat == 'txt': + self.write_txt() def parse_gevent(self): self.parse() @@ -120,4 +122,12 @@ class Crawler: of.write(url_str.format(self.visited.pop())) of.write('') + of.close() + + def write_txt(self): + of = open(self.outputfile, 'w') + url_str = '{}\n' + while self.visited: + of.write(url_str.format(self.visited.pop())) + of.close() \ No newline at end of file diff --git a/setup.py b/setup.py index c94073b..b4c0397 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( version=get_version( major=0, minor=3, - build=7, + build=8, ), packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES), include_package_data=True,