source: products/qPloneGoogleSitemaps/trunk/utils.py @ 804

Last change on this file since 804 was 635, checked in by chervol, 17 years ago

retagging

File size: 688 bytes
RevLine 
[1]1from urllib2 import urlopen
2from urllib  import quote as urlquote
[458]3
[635]4from Globals import DevelopmentMode
[1]5from OFS.ObjectManager import BadRequestException
[458]6
7from Products.qPloneGoogleSitemaps.config import testing
8
9def ping_google(url, sitemap_id):
[1]10    """Ping sitemap to Google"""
[635]11    if DevelopmentMode:
12        #prevent pinging in debug mode
13        print "Pinging Google ...", url, sitemap_id
14        return 0
15
[458]16    resurl = url + "/" + sitemap_id
17    sitemap_url = urlquote(resurl)
[1]18    g = urlopen('http://www.google.com/webmasters/sitemaps/ping?sitemap='+sitemap_url)
19    result = g.read()
20    g.close()
[458]21    if testing:
22        print "Pinged %s sitemap to google" % resurl
[1]23    return 0
Note: See TracBrowser for help on using the repository browser.