Last active
December 18, 2015 18:19
-
-
Save sekimura/5825143 to your computer and use it in GitHub Desktop.
Revisions
-
sekimura revised this gist
Jun 20, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,5 +20,5 @@ def resubmit(sitemap): if __name__ == '__main__': for sitemap in fetch_sitemaps(sys.argv[1]): resubmit(sitemap) -
sekimura created this gist
Jun 20, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import sys import urllib2 import xml.etree.ElementTree as ET PING_URL = 'http://www.google.com/webmasters/tools/ping?sitemap=%s' def fetch_sitemaps(sitemapindex): response = urllib2.urlopen(sitemapindex) xml = response.read() root = ET.fromstring(xml) for loc in root.getiterator('{http://www.sitemaps.org/schemas/sitemap/0.9}loc'): yield loc.text def resubmit(sitemap): url = PING_URL % sitemap response = urllib2.urlopen(url) print response.read() if __name__ == '__main__': for sitemap in fetch_sitemaps(): resubmit(sitemap)