Helper Types

Auxiliar functions and classes that serve general purposes.

Constants

general_func.MAX_POSTS_LIMIT: int = 1000

Classes

class pykemo._aux.aux_classes.FileHashResult(*, file, posts, disc)

Result used when querying for a file using its hash.

Parameters:
  • file (File) – The file itself.

  • posts (list[Post]) – All the normal posts where this file appears.

  • disc (list[DiscordMessage]) – All the discord messages where this file is.

classmethod empty()
Returns:

An instance of the result with empty fields.

Return type:

FileHashResult

Functions

Module for auxilair functions.

pykemo.general.general_func.get_app_version()
Returns:

The last commit hash of the API.

Return type:

str

pykemo.general.general_func.get_creator(service, creator_id)

Tries to retrieve a creator with the given ID and service.

Parameters:
  • service (ServiceLike) – The service of the creator.

  • creator_id (str) – The ID of the creator.

Returns:

The creator instance, if found. Otherwise returns None.

Return type:

Optional[Creator]

Retrieves a list that is the other accounts of a creator, should it have any with other services, for example.

Parameters:
  • service (ServiceLike) – The service of the creator.

  • creator_id (str) – The ID of the creator.

Returns:

A list of the creators associated with this one.

Return type:

list[Creator]

pykemo.general.general_func.get_creators()

Gets all the creators.

Warning

There is currently no limitations to this function. It will really try to fetch ALL the creators on the site. If you do not explicitly need this, do not use it.

Returns:

The list of all creators.

Return type:

list[Creator]

pykemo.general.general_func.get_file_hash(hash)

Search a file by hash. Also tries to retrieve posts where such file is present.

Parameters:

hash (str) – The query hash to search with.

Returns:

The result of the query.

Return type:

FileHashResult

pykemo.general.general_func.get_posts(query=None, max_posts=50, before=None, since=None)

Gets all posts that coincide with the given parameters.

Parameters:
  • query (Optional[str]) – A query string to use in the search.

  • max_posts (int) – The max number of posts to look through. This is NOT necessarily the number of posts to enter the lists.

  • before (Optional[datetime.datetime]) – Include only posts before this date.

  • since (Optional[datetime.datetime]) – Include only posts after and including this date.

Returns:

The list of posts of the query.

Return type:

list[Post]