Last change
on this file since 3606 was
635,
checked in by chervol, 18 years ago
|
retagging
|
File size:
688 bytes
|
Rev | Line | |
---|
[1] | 1 | from urllib2 import urlopen |
---|
| 2 | from urllib import quote as urlquote |
---|
[458] | 3 | |
---|
[635] | 4 | from Globals import DevelopmentMode |
---|
[1] | 5 | from OFS.ObjectManager import BadRequestException |
---|
[458] | 6 | |
---|
| 7 | from Products.qPloneGoogleSitemaps.config import testing |
---|
| 8 | |
---|
| 9 | def 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.