pyconversations.message.RedditPost

class pyconversations.message.RedditPost(**kwargs)[source]

Reddit post object with additional Reddit-specific features

get_mentions()[source]

Uses Reddit specific regex to attempt to identify user mentions within the comment text.

Returns a set of usernames.

Returns

set(str) – The set of extracted usernames

static parse_datestr(x)[source]

Static method that specifies how to convert the native datetime string into a a Python datetime object.

Parameters

x (str) – The raw datetime string

Returns

datetime.datetime – The parsed datetime

static parse_raw(data, lang_detect=False)[source]

Static method that must be implemented by all non-abstract child classes. Concrete implementations should specify how to parse the raw data into this object.

Parameters
  • data (JSON/dict) – The raw data to be pre-processed.

  • lang_detect (bool) – A boolean which specifies whether language detection should be activated. (Default: False)

Returns

list(RedditPost) – The parsed post

static parse_rd(data, lang_detect=True)[source]

Secondary method for parsing raw Reddit data

Parameters
  • data (JSON/dict) – The raw data to be pre-processed.

  • lang_detect (bool) – A boolean which specifies whether language detection should be activated. (Default: True)

Returns

RedditPost – The parsed post