Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 27 lines (23 sloc) 0.744 kB
fdb9141 @mdomsch add PubSubHubbub-Publisher 1.0 to planet/vendor/, use it to publish a…
mdomsch authored
1 import os, sys
2 import urlparse
399b0f0 @rubys Make list of publishable feeds configurable, per:
authored
3 import planet
fdb9141 @mdomsch add PubSubHubbub-Publisher 1.0 to planet/vendor/, use it to publish a…
mdomsch authored
4 import pubsubhubbub_publisher as PuSH
5
6 def publish(config):
399b0f0 @rubys Make list of publishable feeds configurable, per:
authored
7 log = planet.logger
fdb9141 @mdomsch add PubSubHubbub-Publisher 1.0 to planet/vendor/, use it to publish a…
mdomsch authored
8 hub = config.pubsubhubbub_hub()
9 link = config.link()
399b0f0 @rubys Make list of publishable feeds configurable, per:
authored
10
11 # identify feeds
12 feeds = []
fdb9141 @mdomsch add PubSubHubbub-Publisher 1.0 to planet/vendor/, use it to publish a…
mdomsch authored
13 if hub and link:
14 for root, dirs, files in os.walk(config.output_dir()):
399b0f0 @rubys Make list of publishable feeds configurable, per:
authored
15 for file in files:
16 if file in config.pubsubhubbub_feeds():
17 feeds.append(urlparse.urljoin(link, file))
18
19 # publish feeds
20 if feeds:
21 try:
22 PuSH.publish(hub, feeds)
23 for feed in feeds:
24 log.info("Published %s to %s\n" % (feed, hub))
25 except PuSH.PublishError, e:
26 log.error("PubSubHubbub publishing error: %s\n" % e)
Something went wrong with that request. Please try again.