lkiesow / python-feedgen

Python module to generate ATOM feeds, RSS feeds and Podcasts.

Home Page:https://feedgen.kiesow.be/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

atom_str and rss_str return bytestrings when their docstrings indicate they return strings (Python3)

ned2 opened this issue · comments

Under Python 3 atom_str and rss_str in feed.py both return a bytestring when their docstrings indicate they return strings. This seems to be because xml.etree.ElementTree.tostring returns a bytestring unless the encoding='unicode' argument is supplied. I did try passing in this parameter but it doesn't seem like lxml likes this: ValueError: Serialisation to unicode must not request an XML declaration

You can get Unicode back like this:

fg.atom_str(xml_declaration=False, encoding='Unicode')

I've added a note about this to the method's documentation.