Atom and RSS feed parser for Python 3
Atom and RSS feed parser for Python 3.
Install Atoma with pip:
pip install atoma
Load and parse an Atom XML file:
>>> import atoma >>> feed = atoma.parse_rss_file('rss-feed.xml') >>> feed.description 'The blog relating the daily life of web agency developers' >>> len(feed.items) 5
Parsing feeds from the Internet is easy as well:
>>> import atoma, requests >>> response = requests.get('http://lucumr.pocoo.org/feed.atom') >>> feed = atoma.parse_atom_bytes(response.content) >>> feed.title.value "Armin Ronacher's Thoughts and Writings"
If you use this library to display content from feeds in a web page, you NEED to clean the HTML contained in the feeds to prevent Cross-site scripting (XSS). The bleach library is recommended for cleaning feeds.
To use this library a basic understanding of feeds is required. For Atom, the Introduction to Atom is a must read. The RFC 4287 can help lift some ambiguities. Finally the feed validator is great to test hand-crafted feeds.
Some seldom used features are not implemented:
- XML signature and encryption
- Atom and most RSS extensions
- Atom content other than text, html and xhtml
MIT Copyright (c) 2018 Nicolas Le Manchet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|atoma-0.0.3-py3-none-any.whl (10.8 kB) Copy SHA256 hash SHA256||Wheel||py3||Mar 20, 2018|
|atoma-0.0.3.tar.gz (7.1 kB) Copy SHA256 hash SHA256||Source||None||Mar 20, 2018|