O'Reilly logo

Learning Python Design Patterns by Gennadiy Zlobin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementation in Python

Imagine you are building a news aggregator and want to get the latest news from a lot of news sites. The news sites typically provide news with RSS and Atom protocols. These protocols are based on XML and are mostly similar with exception to some details.

The following is an example of an RSS feed. Here we have a set of item tags that correspond to a published item (news, or blog posts, and so on).

In every item, we have a short title, longer description, and a direct link to an item as shown in the following code:

<?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <channel> <title>A RSS example</title> <link>http://example.com</link> <description>Description of RSS example</description> <item> <title>The first ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required