[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Is there any Generic RSS/ATOM generator in Python?

js

2/11/2008 2:48:00 PM

Hi,

I'm looking for RSS/ATOM generator I can use in Python.
I searched on pypi and the other places but I couldn't find any
options on this. (I found many parsers, though)
Is there any de-fact standard RSS/ATOM generator? (especially, I'd
like to create Atom's)
Do I have to do it myself from scratch?

Thanks in advance.
13 Answers

Stefan Behnel

2/11/2008 3:25:00 PM

0

js wrote:
> I'm looking for RSS/ATOM generator I can use in Python.
> I searched on pypi and the other places but I couldn't find any
> options on this. (I found many parsers, though)
> Is there any de-fact standard RSS/ATOM generator? (especially, I'd
> like to create Atom's)
> Do I have to do it myself from scratch?

Try googling for "python atom", gives me this as first hit:

http://www.imc.org/atom-syntax/mail-archive/msg...

But since it's not that hard to generate XML in general, maybe these are also
worth another look:

http://blog.ianbicking.org/2007/08/02/at...
http://codespeak.net/lxml/objectify.html#tree-generation-with-the...

Stefan

Terran Melconian

2/14/2008 7:00:00 AM

0

On 2008-02-11, js <ebgssth@gmail.com> wrote:
> Is there any de-fact standard RSS/ATOM generator? (especially, I'd
> like to create Atom's)
> Do I have to do it myself from scratch?

I looked into similar issues about six months ago. My conclusion was
that generally XML generation libraries (unlike parsers) don't get
written, because there's little enough to them that it isn't seen as
worth doing, and that accepted practice is to just do it yourself.

Torsten Bronger

2/14/2008 7:28:00 AM

0

Hallöchen!

Terran Melconian writes:

> On 2008-02-11, js <ebgssth@gmail.com> wrote:
>
>> Is there any de-fact standard RSS/ATOM generator? (especially,
>> I'd like to create Atom's) Do I have to do it myself from
>> scratch?
>
> I looked into similar issues about six months ago. My conclusion
> was that generally XML generation libraries (unlike parsers) don't
> get written, because there's little enough to them that it isn't
> seen as worth doing, and that accepted practice is to just do it
> yourself.

Maybe I understand you wrongly but there *is* a general XML
generator with ElementTree. I wouldn't generate XML directly but
using ElementTree to generate Atom. I did it myself three months
ago and it was really trivial.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger@jabber.org
(See http://ime.... for further contact info.)

Stefan Behnel

2/14/2008 7:42:00 AM

0

Torsten Bronger wrote:
> Terran Melconian writes:
>
>> On 2008-02-11, js <ebgssth@gmail.com> wrote:
>>
>>> Is there any de-fact standard RSS/ATOM generator? (especially,
>>> I'd like to create Atom's) Do I have to do it myself from
>>> scratch?
>> I looked into similar issues about six months ago. My conclusion
>> was that generally XML generation libraries (unlike parsers) don't
>> get written, because there's little enough to them that it isn't
>> seen as worth doing, and that accepted practice is to just do it
>> yourself.
>
> Maybe I understand you wrongly but there *is* a general XML
> generator with ElementTree. I wouldn't generate XML directly but
> using ElementTree to generate Atom. I did it myself three months
> ago and it was really trivial.

Actually, there's tons of XML generator packages (most of them single Python
modules), ElementTree itself and the "E factory" being only two of them.

Stefan

Torsten Bronger

2/14/2008 7:58:00 AM

0

Hallöchen!

Stefan Behnel writes:

> Torsten Bronger wrote:
>
>> Terran Melconian writes:
>>
>> [...]
>>
>> Maybe I understand you wrongly but there *is* a general XML
>> generator with ElementTree. I wouldn't generate XML directly but
>> using ElementTree to generate Atom. I did it myself three months
>> ago and it was really trivial.
>
> Actually, there's tons of XML generator packages (most of them
> single Python modules), ElementTree itself and the "E factory"
> being only two of them.

I mentioned ElementTree because in my opinion, it is the only sane
XML generator in the standard lib.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger@jabber.org
(See http://ime.... for further contact info.)

js

2/14/2008 12:34:00 PM

0

Trivial?
More than XML::Atom::Feed?
http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/At...

On 2/14/08, Torsten Bronger <bronger@physik.rwth-aachen.de> wrote:
> Hallöchen!
>
>
> Terran Melconian writes:
>
> > On 2008-02-11, js <ebgssth@gmail.com> wrote:
> >
> >> Is there any de-fact standard RSS/ATOM generator? (especially,
> >> I'd like to create Atom's) Do I have to do it myself from
> >> scratch?
> >
> > I looked into similar issues about six months ago. My conclusion
> > was that generally XML generation libraries (unlike parsers) don't
> > get written, because there's little enough to them that it isn't
> > seen as worth doing, and that accepted practice is to just do it
> > yourself.
>
>
> Maybe I understand you wrongly but there *is* a general XML
> generator with ElementTree. I wouldn't generate XML directly but
> using ElementTree to generate Atom. I did it myself three months
> ago and it was really trivial.
>
> Tschö,
> Torsten.
>
>
> --
> Torsten Bronger, aquisgrana, europa vetus
> Jabber ID: bronger@jabber.org
> (See http://ime.... for further contact info.)
>
> --
> http://mail.python.org/mailman/listinfo/p...
>

Torsten Bronger

2/14/2008 12:59:00 PM

0

Hallöchen!

js writes:

> Trivial?
> More than XML::Atom::Feed?
> http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/At...

Excerpt from my code:

root = ElementTree.Element("feed", xmlns="http://www.w3.org/2005/...)
ElementTree.SubElement(root, "id").text = self.id
ElementTree.SubElement(root, "title").text = self.title
ElementTree.SubElement(root, "updated").text = format_time(self.updated)

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger@jabber.org
(See http://ime.... for further contact info.)

Stefan Behnel

2/14/2008 1:22:00 PM

0

Torsten Bronger wrote:
> js writes:
>
>> Trivial?
>> More than XML::Atom::Feed?
>> http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/At...
>
> Excerpt from my code:
>
> root = ElementTree.Element("feed", xmlns="http://www.w3.org/2005/...)
> ElementTree.SubElement(root, "id").text = self.id
> ElementTree.SubElement(root, "title").text = self.title
> ElementTree.SubElement(root, "updated").text = format_time(self.updated)

Look at the bottom of this page for an RSS example using the "E factory":

http://effbot.org/zone/element-b...

I find it much more readable than the above code, especially if you use the
version that comes with lxml.objectify, which has better support for
namespaces and data types:

http://codespeak.net/lxml/objectify.html#tree-generation-with-the...

Stefan

Torsten Bronger

2/14/2008 1:32:00 PM

0

Hallöchen!

Stefan Behnel writes:

> Torsten Bronger wrote:
>
>> [...]
>>
>> Excerpt from my code:
>>
>> root = ElementTree.Element("feed", xmlns="http://www.w3.org/2005/...)
>> ElementTree.SubElement(root, "id").text = self.id
>> ElementTree.SubElement(root, "title").text = self.title
>> ElementTree.SubElement(root, "updated").text = format_time(self.updated)
>
> Look at the bottom of this page for an RSS example using the "E factory":
>
> http://effbot.org/zone/element-b...
>
> I find it much more readable than the above code, especially if you use the
> version that comes with lxml.objectify, which has better support for
> namespaces and data types:
>
> http://codespeak.net/lxml/objectify.html#tree-generation-with-the...

If you have more complex tasks, all this may be true; however,
generating Atom is just *so* simple that I prefer the version which
works without tweaking and further dependencies.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger@jabber.org
(See http://ime.... for further contact info.)

Stefan Behnel

2/14/2008 1:51:00 PM

0

Torsten Bronger wrote:
> Stefan Behnel writes:
>
>> Torsten Bronger wrote:
>>
>>> [...]
>>>
>>> Excerpt from my code:
>>>
>>> root = ElementTree.Element("feed", xmlns="http://www.w3.org/2005/...)
>>> ElementTree.SubElement(root, "id").text = self.id
>>> ElementTree.SubElement(root, "title").text = self.title
>>> ElementTree.SubElement(root, "updated").text = format_time(self.updated)
>>
>> Look at the bottom of this page for an RSS example using the "E factory":
>>
>> http://effbot.org/zone/element-b...
[...]
> If you have more complex tasks, all this may be true; however,
> generating Atom is just *so* simple that I prefer the version which
> works without tweaking and further dependencies.

The E factory is a small module with one main class. Adding that to your code
base doesn't give you any dependencies...

Stefan