source: products/qPloneGoogleSitemaps/branches/contenttype/utils.py @ 1572

Last change on this file since 1572 was 634, checked in by crchemist, 17 years ago

Captcha checks fixed.

File size: 688 bytes
RevLine 
[1]1from urllib2 import urlopen
2from urllib  import quote as urlquote
[423]3
[634]4from Globals import DevelopmentMode
[425]5from OFS.ObjectManager import BadRequestException
6
[454]7from Products.qPloneGoogleSitemaps.config import testing
8
[414]9def ping_google(url, sitemap_id):
[1]10    """Ping sitemap to Google"""
[634]11    if DevelopmentMode:
12        #prevent pinging in debug mode
13        print "Pinging Google ...", url, sitemap_id
14        return 0
15
[454]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()
[454]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.