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

Last change on this file was 634, checked in by crchemist, 13 years ago

Captcha checks fixed.

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