assembl.models.feed_parsing module¶
Utilities for extracting posts and from a RSS or Atom feed.
-
class
assembl.models.feed_parsing.FeedFetcher[source]¶ Bases:
objectA thin wrapper around requests in order to be able to get a feed from a web resource address, returning either as a string object (which is the preferred method for feedparser) or as a StringIO object (which is what speedparser likes)
-
class
assembl.models.feed_parsing.FeedPost(*args, **kwargs)[source]¶ Bases:
assembl.models.post.ImportedPostA discussion post that is imported from an external feed source.
-
body_mime_type¶ The mime type of the body of the imported content. See Content::get_body_mime_type() for allowed values.
-
message_id¶ The email-compatible message-id for the post.
-
source_post_id¶ The source-specific unique id of the imported post. A listener keeps the message_id in the post class in sync
-
-
class
assembl.models.feed_parsing.FeedPostSource(**kwargs)[source]¶ Bases:
assembl.models.generic.PostSourceThe source of an imported feed, be it Atom, RSS, or any other type of feed protocol.
-
post_type¶ alias of
assembl.models.feed_parsing.FeedPost
-
user_type¶
-
-
class
assembl.models.feed_parsing.LoomioAccount(**kwargs)[source]¶ Bases:
assembl.models.feed_parsing.WebLinkAccountAn imported Loomio name and address. This is not an authenticated user.
-
class
assembl.models.feed_parsing.LoomioFeedPost(*args, **kwargs)[source]¶ Bases:
assembl.models.feed_parsing.FeedPostA discussion post this is imported from a feed extracted from Loomio.
-
body_mime_type¶ The mime type of the body of the imported content. See Content::get_body_mime_type() for allowed values.
-
message_id¶ The email-compatible message-id for the post.
-
source_post_id¶ The source-specific unique id of the imported post. A listener keeps the message_id in the post class in sync
-
-
class
assembl.models.feed_parsing.LoomioPostSource(**kwargs)[source]¶ Bases:
assembl.models.feed_parsing.FeedPostSourceThe source an imported feed, that came directly from Loomio.
-
post_type¶
-
user_type¶
-
-
class
assembl.models.feed_parsing.PaginatedParsedData(url, parser_wrapper=None, page_key='page', start_page=1)[source]¶ Bases:
assembl.models.feed_parsing.ParsedDataExtention of the “Data Getter” object, which supports basic pagination of data.
@TODO: Extend this object to support variable key pagination, rather than simple integer incrementation.
-
class
assembl.models.feed_parsing.ParsedData(url, parser_wrapper=None)[source]¶ Bases:
objectFor every atom feed URL that is fetched, a ParsedData object is generated to handle the retrieving the feed, the entries, or other fields as needed. This object is the base “Data Getter” object for atom feeds.
@TODO: Extend this class to suport RRS feeds as well.
-
class
assembl.models.feed_parsing.ParserWrapper(fetcher, parser, parser_can_read_file=False)[source]¶ Bases:
objectA moderate wrapper around which parsing module is used (feedparser vs speedparser).
-
class
assembl.models.feed_parsing.WebLinkAccount(**kwargs)[source]¶ Bases:
assembl.models.auth.AbstractAgentAccountAn imported name that has not been validated nor authenticated within the platform. This is to keep track of an imported post’s ownership.
-
unique_query()[source]¶ returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.
-