asphalt.feedreader.readers.base

class asphalt.feedreader.readers.base.BaseFeedReader(url: str, store: typing.Union[str, asphalt.feedreader.api.FeedStateStore] = None, state_id: str = None, client_session: typing.Union[str, aiohttp.client.ClientSession] = None, http_headers: typing.Dict[str, typing.Any] = None, interval: typing.Union[int, datetime.timedelta, NoneType] = 300)

Bases: asphalt.feedreader.api.FeedReader

Base class for news syndication feeds.

Variables:

metadata (FeedMetadata) – latest metadata extracted from the feed

Parameters:
  • url (str) – source URL for the feed
  • store (Union[str, FeedStateStore, None]) – a feed state store or the resource name of one
  • state_id (Optional[str]) – unique identifier to use for the state of this feed in the state store (defaults to the value of url)
  • client_session (Union[str, ClientSession, None]) – an aiohttp client session or the resource name of one
  • http_headers (Optional[Dict[str, Any]]) – dictionary of HTTP request headers to use when loading the feed
  • interval (Union[int, timedelta, None]) – interval (in seconds) in which to call update() (0 or None) to disable automatic checking
metadata_cls

alias of FeedMetadata

parse_document(document)

Parse the downloaded document.

Parameters:document (str) – the downloaded document content
Return type:Tuple[Dict[str, Any], List[FeedEntry]]
Returns:a two-tuple of (feed metadata, list of entries found in the document)