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