Tags Reference
The tags are a way to further filter searches.
Tags
- class pykemo.tags.tag.Tag(value, post_count)
A tag is a simple categorization of content, given a name.
- Parameters:
value (
str) – The value of the tag.post_count (
int) – How many posts have this tag.
- async classmethod all(ks, *, as_dict=False)
Gets all the tags found on the site. Might take a while.
- Parameters:
session (
KemoSession) – The session instance.as_dict (
bool, optional) – Wether to return a dictionary with the tags names as keys and their post counts as values, defaults toFalse.ks (KemoSession)
- Returns:
A list with all tags that were found, or a dictionary of their values; according to
as_dict.- Return type:
TagsResult
- async classmethod from_names(names, ks, *, cache=None)
Tries to retrieve tags based on their names.
- Parameters:
names (Iterable[
str]) – The names to search for.session (
KemoSession) – The session instance.cache (Optional[
TagsDict]) – An optional dict to consult the tags from.ks (KemoSession)
- Returns:
The tags in question.
- Return type:
Optional[
Tag]
- set_underlying_session(ks)
Quietly sets the session which the tag uses for its requests.
- Parameters:
session (
KemoSession) – The session instance.ks (KemoSession)
- Returns:
The same instance of the tag, for convenience.
- Return type:
- async classmethod with_name(name, ks, *, cache=None)
Tries to retrieve a tag with a given name. It may not exist.
- Parameters:
name (
str) – The name to search for.session (
KemoSession) – The session instance.cache (Optional[
TagsDict]) – An optional dict to consult the tags from.ks (KemoSession)
- Returns:
The tag in question, or
Noneif it was not found.- Return type:
Optional[
Tag]