oldas.articles
Provides a class for getting article data.
Direction
module-attribute
Direction = Literal['ltr', 'rtl']
Possible values for the summary direction.
Alternate
dataclass
Holds details of an alternate for an Article.
Alternates
Article
dataclass
Article(
id: str,
title: str,
published: datetime,
updated: datetime,
author: str,
summary: Summary,
categories: list[State | str],
origin: Origin,
alternate: Alternates,
)
Holds details about an article.
categories
instance-attribute
The list of categories associated with this article.
clean_categories
staticmethod
Clean up a collection of categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Iterable[str]
|
The categories to clean up. |
required |
Returns:
| Type | Description |
|---|---|
list[State | str]
|
The cleaned categories. |
The incoming list of categories will simply be a list of strings, but each of them may refer to a folder or a state, etc. This method will clean the list, turning relevant values into their specific type.
Note
For the moment only values matching a State
will be turned into their related type.
from_json
classmethod
mark_read
async
Articles
Loads and holds a full list of articles.
full_id
staticmethod
stream
async
classmethod
stream(
session: Session,
stream: str | Subscription | Folder = "",
**filters: Any,
) -> AsyncIterator[Article]
Load articles from a given stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
|
str | Subscription | Folder
|
The stream identifier to load from. |
''
|
|
Any
|
Any other filters to pass to the API. |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[Article]
|
The articles matching the request. |
stream_new_since
async
classmethod
stream_new_since(
session: Session,
since: datetime,
stream: str | Subscription | Folder = "",
**filters: Any,
) -> AsyncIterator[Article]
Stream all articles newer than a given time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
The API session object. |
required |
|
datetime
|
Time from which to load articles. |
required |
|
str | Subscription | Folder
|
The stream identifier to stream from. |
''
|
|
Any
|
Any other filters to pass to the API. |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[Article]
|
The articles matching the request. |
Origin
dataclass
The origin details for an Article.
Summary
dataclass
The summary details for an Article.