Last change
on this file since 1623 was
1623,
checked in by mylan, 14 years ago
|
Fix URL for resubmission (pinging) of the new sitemap
|
-
Property svn:eol-style set to
native
|
File size:
645 bytes
|
Rev | Line | |
---|
[1593] | 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.config import testing |
---|
| 8 | |
---|
| 9 | def ping_google(url, sitemap_id): |
---|
| 10 | """Ping sitemap to Google""" |
---|
[1622] | 11 | |
---|
| 12 | resurl = url + "/" + sitemap_id |
---|
| 13 | |
---|
| 14 | if DevelopmentMode or testing: |
---|
| 15 | #prevent pinging in debug or testing mode |
---|
| 16 | print "Pinged %s sitemap to Google" % resurl |
---|
[1593] | 17 | return 0 |
---|
| 18 | |
---|
| 19 | sitemap_url = urlquote(resurl) |
---|
[1622] | 20 | |
---|
[1623] | 21 | g = urlopen('http://www.google.com/webmasters/tools/ping?sitemap='+sitemap_url) |
---|
[1593] | 22 | result = g.read() |
---|
| 23 | g.close() |
---|
[1622] | 24 | |
---|
[1593] | 25 | return 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.