Last change
on this file was
2412,
checked in by mylan, 14 years ago
|
#131: Remove needless add/remove news-sitemaps related schema adapter registration methods
|
-
Property svn:eol-style set to
native
|
File size:
644 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 quintagroup.plonegooglesitemaps import config |
---|
8 | |
---|
9 | def ping_google(url, sitemap_id): |
---|
10 | """Ping sitemap to Google""" |
---|
11 | |
---|
12 | resurl = url + "/" + sitemap_id |
---|
13 | |
---|
14 | if DevelopmentMode or config.testing: |
---|
15 | #prevent pinging in debug or testing mode |
---|
16 | print "Pinged %s sitemap to Google" % resurl |
---|
17 | return 0 |
---|
18 | |
---|
19 | sitemap_url = urlquote(resurl) |
---|
20 | |
---|
21 | g = urlopen('http://www.google.com/webmasters/tools/ping?sitemap='+sitemap_url) |
---|
22 | result = g.read() |
---|
23 | g.close() |
---|
24 | |
---|
25 | return 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.