Skip to content

oldas.articles

Provides a class for getting article data.

Direction module-attribute

Direction = Literal['ltr', 'rtl']

Possible values for the summary direction.

Article

Bases: NamedTuple

Holds details about an article.

author instance-attribute

author

The author of the article.

categories instance-attribute

categories

The list of categories associated with this article.

id instance-attribute

id

The ID of the article.

is_fresh property

is_fresh

Is the article considered fresh?

is_read property

is_read

Has this article been read?

is_stale property

is_stale

Is the article considered stale?

is_unread property

is_unread

Is the article still unread?

is_updated property

is_updated

Does the article look like it's been updated?

origin instance-attribute

origin

The origin of the article.

published instance-attribute

published

The time when the article was published.

raw class-attribute instance-attribute

raw = None

The raw data from the API.

summary instance-attribute

summary

The summary of the article.

title instance-attribute

title

The title of the article.

updated instance-attribute

updated

The time when the article was updated.

clean_categories staticmethod

clean_categories(categories)

Clean up a collection of categories.

Parameters:

Name Type Description Default

categories

Iterable[str]

The categories to clean up.

required

Returns:

Type Description
list[State | str]

The cleaned categories.

from_json classmethod

from_json(data)

Load the article from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the article from.

required

Returns:

Type Description
Article

The article.

mark_read async

mark_read(session)

Mark the article as read.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
bool

The boolean response from the API.

mark_unread async

mark_unread(session)

Mark the article as unread.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

Returns:

Type Description
bool

The boolean response from the API.

Articles

Articles(data=None)

Bases: OldList[Article]

Loads and holds a full list of articles.

stream async classmethod

stream(session, stream='', **filters)

Load articles from a given stream.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

stream

str | Subscription | Folder

The stream identifier to load from.

''

Yields:

Type Description
AsyncIterator[Article]

The articles.

stream_new_since async classmethod

stream_new_since(session, since, stream='', **filters)

Stream all articles newer than a given time.

Parameters:

Name Type Description Default

session

Session

The API session object.

required

since

datetime

Time from which to load articles.

required

stream

str | Subscription | Folder

The stream identifier to stream from.

''

Yields:

Type Description
AsyncIterator[Article]

Articles.

Origin

Bases: NamedTuple

The origin details for an article.

html_url instance-attribute

html_url

The URL of the HTML of the origin of the article.

raw class-attribute instance-attribute

raw = None

The raw data from the API.

stream_id instance-attribute

stream_id

The stream ID for the article's origin.

title instance-attribute

title

The title of the origin of the article.

from_json classmethod

from_json(data)

Load the origin from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the origin from.

required

Returns:

Type Description
Origin

The summary.

Summary

Bases: NamedTuple

The summary details for an article.

content instance-attribute

content

The content of the summary.

direction instance-attribute

direction

The direction for the text in the summary.

raw class-attribute instance-attribute

raw = None

The raw data from the API.

from_json classmethod

from_json(data)

Load the summary from JSON data.

Parameters:

Name Type Description Default

data

RawData

The data to load the summary from.

required

Returns:

Type Description
Summary

The summary.