[Zope] rss

Andy McKay andym@ActiveState.com
Thu, 14 Dec 2000 10:07:40 -0800


Actually I went one further and hacked SiteSummary so that it remembered the
url the rss is located at (rss_url). Then I wrote a quick reload method.
Then in dtml I wrote a method that finds all the site summaries and reloads
them. So my python script is down to two lines:

import urllib
print urllib.urlopen(..../reload)

Or something like that. It also means anyone can add news feeds on the fly,
check out:

http://www.agmweb.ca/rss

--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "Kevin Teague" <kteague@stormix.com>
To: "Andy McKay" <andym@activestate.com>; <zope@zope.org>
Sent: Wednesday, December 13, 2000 3:20 PM
Subject: Re: [Zope] rss


> I'm setting up some rss feeds, and I've just used the Site Summary
> product from here:
>
> http://www.zope.org/Members/edmundd/SiteSummary
>
> With Site Summary you can use the importRSS method to pull in a channel.
> I use a modified version of this script running on a cron job to update
> the rss channels:
>
> http://www.zope.org/Members/phd/cron-zope/pack-db_fs
>
> The script looks like this (it's still kind of hack-ish, but it works
> :). My only problem now is to figure out how to have member preferences
> handle a list of rss channels with the PTK.
>
>
> #!/usr/bin/python
>
> username="kteague"
> password="******"
> zope="http://www.evileggs.org/"
>
> import sys, urllib, re
>
> class NoGUIURLopener(urllib.FancyURLopener):
>    def __init__(self, username, password, *args):
>       apply(urllib.FancyURLopener.__init__, (self,) + args)
>
>       self.username = username
>       self.password = password
>       self.asked = 0
>
>    def prompt_user_passwd(self, host, realm):
>       if self.asked:
>          raise "Unauthorized"
>       else:
>          self.asked = 1
>          return self.username, self.password
>
>
> channel_id = ""
> rss_url = ""
>
> try:
>     f = open("channellist.txt")
> except:
>    print 'Could not open the channellist.txt file.'
> lines = f.readlines()
> f.close()
>
> for line in lines:
>     if re.search('^\n$', line):
>         continue
>     m = re.search('(.*?)\s+(.*)', line)
>     try:
>         (channel_id, rss_url) = m.groups()
>     except:
>         print 'Can not properly parse line:\n%s' % (line)
>         continue
>     urllib._urlopener = NoGUIURLopener(username, password)
>     urllib.urlretrieve("%s/rss/%s/importRSS?url=%s" % (zope, channel_id,
> rss_url))
>
>
>
> ==================
> And the 'channellist.txt' text file just has the Zope id's of the Site
> Summary objects and the rss channel URLs, like so:
>
>
> Advogato   http://www.advogato.com/rss/articles.xml
> Linux.com   http://www.linux.com/mrn/front_page.rss
>
>
> --
>   Kevin Teague, Zopista
>   http://www.stormix.com
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>