Posts Reference

Post

class pykemo.posts.posts.Post(*, id, creator_id, service, title, content, substring, embed, shared_file, added=None, published, edited=None, file=None, attachments=<factory>, creator, is_revision=False)

Post with content.

Parameters:
  • id (str) – The ID of the post.

  • creator_id (str) – The creator’s ID that owns the post content (not the user that uploaded it).

  • service (ServiceLike) – The services that provides the content.

  • title (str) – The title of the post.

  • content (str) – The content string of the post.

  • substring (str) – The sub-string for the post description.

  • embed (dict) – A dictionary denoting the embed.

  • shared_file (bool) – Wether the post has a shared file.

  • added (Optional[datetime.datetime]) – When was the post added.

  • published (datetime.datetime) – When was the post published.

  • edited (Optional[datetime.datetime]) – When was the post last edited.

  • file (Optional[File]) – The file that the posts uses when previewed.

  • attachments (list[File]) – All the files under this post.

  • creator (Creator) – The creator of this post.

  • is_revision (bool) – Flag to see if this post is a revision of another.

before(date)

Verifies if the post was published before a certain date.

Returns:

The result of Post.published < date

Return type:

bool

Parameters:

date (datetime)

property comments: list[Comment]
Returns:

The comments of the post.

Return type:

list[Comment]

fetch_comments()

Fetches the comments of the post. .. warning:: This is designed for internal purposes, as it is recommended to use the comments property instead. However, it can also be used as-is to prevent using a potentially outdated field.

Returns:

A list of the comments of this post.

Return type:

list[Comment]

property flagged: bool
Returns:

Wether the post is flagged for reimport.

Return type:

bool

property revisions: list[PostRevision]
Returns:

All the revisions of this post.

Return type:

list[PostRevision]

save(path=None, force=True, verbose=True)

Tries to save all the files in the post.

Parameters:
  • path (Union[PathLike, Path, None]) – The optional path where to store all the files. If it ends with ‘/*’, it will use its default name inside such folder.

  • force (bool) – Wether to overwrite existing files

  • verbose (bool) – Wether to track progress.

Returns:

True if the download of all files was successful, or False if not.

Return type:

bool

since(date)

Verifies if the post was published since a certain date.

Returns:

The result of Post.published >= date

Return type:

bool

Parameters:

date (datetime)

property url: UrlLike
Returns:

The full URL of the post.

Return type:

UrlLike

class pykemo.posts.post_revisions.PostRevision(*, revision_id, post)

A post revision is an edit made to a post, at any given time.

Parameters:
  • revision_id (str) – The ID of the revision itself.

  • post (Post) – The underlying post of the revision. This is a post in itself, a copy of how the post was at that time.

Comment

class pykemo.comments.comments.Comment(*, id, parent_id=None, commenter_id, commenter_name, content, published, revisions, commenter, post)

Comment of a post. Usually instantiated through Post.comments

Parameters:
  • id (str) – The ID of the comment itself.

  • parent_id (Optional[str]) – The ID of the parent comment. Used when the comment itself is a response to another.

  • commenter_id (str) – The ID of the author of the comment.

  • commenter_name (str) – The name of the author of the comment

  • content (str) – The actual content of the comment.

  • published (datetime.datetime) – When was the comment created.

  • revisions (list[CommentRevision]) – Subsequent edits of the comment.

  • commenter (Creator) – The creator of this comment.

  • post (Post) – The parent post this comment belongs to.

property url: UrlLike
Returns:

The direct URL of the comment.

Return type:

UrlLike

class pykemo.comments.comments_rev.CommentRevision(*, id, content, added)

A comment revision. A revision is an edit that can be applied to any given comment by its author, provided that they wanted to changes its contents at some point.

Parameters:
  • id (int) – The ID of the revision. Usually an integer indicating the number of the revision.

  • content (str) – The modified contents of the message.

  • added (datetime.datetime) – When was this revision applied.