Previous topic

libearth.stage — Staging updates and transactions

Next topic

libearth.tz — Basic timezone implementations

This Page

libearth.subscribe — Subscription list

Maintain the subscription list using OPML format, which is de facto standard for the purpose.

class libearth.subscribe.Body(_parent=None, **attributes)

Represent body element of OPML document.

children

(collections.MutableSequence) Child Outline objects.

class libearth.subscribe.Category(_parent=None, **attributes)

Category which groups Subscription objects or other Category objects. It implements collections.MutableSet protocol.

children

(collections.MutableSequence) The list of child Outline elements. It’s for internal use.

class libearth.subscribe.CommaSeparatedList

Encode strings e.g. ['a', 'b', 'c'] into a comma-separated list e.g. 'a,b,c', and decode it back to a Python list. Whitespaces between commas are ignored.

>>> codec = CommaSeparatedList()
>>> codec.encode(['technology', 'business'])
'technology,business'
>>> codec.decode('technology, business')
['technology', 'business']
class libearth.subscribe.Head(_parent=None, **attributes)

Represent head element of OPML document.

owner_email

(str) The owner’s email.

owner_name

(str) The owner’s name.

owner_uri

(str) The owner’s website url.

title

(str) The title of the subscription list.

class libearth.subscribe.Outline(_parent=None, **attributes)

Represent outline element of OPML document.

created_at

(datetime.datetime) The created time.

label

(str) The human-readable text of the outline.

type

(str) Internally-used type identifier.

class libearth.subscribe.Subscription(_parent=None, **attributes)

Subscription which holds referring feed_uri.

feed_id

(str) The feed identifier to be used for lookup. It’s intended to be SHA1 digest of Feed.id value (which is UTF-8 encoded).

feed_uri

(str) The feed url.

alternate_uri

(str) The web page url.

class libearth.subscribe.SubscriptionList(_parent=None, **kwargs)

The set (exactly, tree) of subscriptions. It consists of Subscriptions and Category objects for grouping. It implements collections.MutableSet protocol.

owner

(Person) The owner of the subscription list.

title

(str) The title of the subscription list.

version

(distutils.version.StrictVersion) The OPML version number.

class libearth.subscribe.SubscriptionSet

Mixin for SubscriptionList and Category, both can group Subscription object and other Category objects, to implement collections.MutableSet protocol.

categories

(collections.Mapping) Label to Category instance mapping.

children
(collections.MutableSequence) Child Outline
objects.

Note

Every subclass of SubscriptionSet has to override children property to implement details.

subscribe(feed)

Add a subscription from Feed instance. Prefer this method over add() method.

Parameters:feed (Feed) – feed to subscribe
subscriptions

(collections.Set) The subset which consists of only Subscription instances.

Fork me on GitHub