Moebooru API Reference¶
pybooru.api_moebooru
This module contains all API calls of Moebooru.
- Classes:
- MoebooruApi_Mixin – Contains all API calls.
-
class
pybooru.api_moebooru.
MoebooruApi_Mixin
¶ Bases:
object
Contains all Moebooru API calls.
- API Versions: 1.13.0+update.3 and 1.13.0
- doc: https://yande.re/help/api or https://konachan.com/help/api
-
post_list
(**params)¶ Get a list of posts.
Parameters: - tags (str) – The tags to search for. Any tag combination that works on the web site will work here. This includes all the meta-tags.
- limit (int) – How many posts you want to retrieve. There is a limit of 100:param posts per request.
- page (int) – The page number.
-
post_create
(tags, file_=None, rating=None, source=None, rating_locked=None, note_locked=None, parent_id=None, md5=None)¶ Function to create a new post (Requires login).
There are only two mandatory fields: you need to supply the ‘tags’, and you need to supply the ‘file_’, either through a multipart form or through a source URL (Requires login) (UNTESTED).
Parameters: - tags (str) – A space delimited list of tags.
- file (str) – The file data encoded as a multipart form. Path of content.
- rating (str) – The rating for the post. Can be: safe, questionable, or explicit.
- source (str) – If this is a URL, Moebooru will download the file.
- rating_locked (bool) – Set to True to prevent others from changing the rating.
- note_locked (bool) – Set to True to prevent others from adding notes.
- parent_id (int) – The ID of the parent post.
- md5 (str) – Supply an MD5 if you want Moebooru to verify the file after uploading. If the MD5 doesn’t match, the post is destroyed.
Raises: PybooruAPIError
– When file or source are empty.
-
post_update
(post_id, tags=None, file_=None, rating=None, source=None, is_rating_locked=None, is_note_locked=None, parent_id=None)¶ Update a specific post.
Only the ‘post_id’ parameter is required. Leave the other parameters blank if you don’t want to change them (Requires login).
Parameters: - post_id (int) – The id number of the post to update.
- tags (str) – A space delimited list of tags. Specify previous tags.
- file (str) – The file data ENCODED as a multipart form.
- rating (str) – The rating for the post. Can be: safe, questionable, or explicit.
- source (str) – If this is a URL, Moebooru will download the file.
- rating_locked (bool) – Set to True to prevent others from changing the rating.
- note_locked (bool) – Set to True to prevent others from adding notes.
- parent_id (int) – The ID of the parent post.
-
post_destroy
(post_id)¶ Function to destroy a specific post.
You must also be the user who uploaded the post (or you must be a moderator) (Requires Login) (UNTESTED).
Parameters: post_id (int) – The id number of the post to delete.
Function to reverts a post to a previous set of tags (Requires login) (UNTESTED).
Parameters: - post_id (int) – The post id number to update.
- history_id (int) – The id number of the tag history.
-
post_vote
(post_id, score)¶ Action lets you vote for a post (Requires login).
Parameters: - post_id (int) – The post id.
- score (int) –
- 0: No voted or Remove vote.
- 1: Good.
- 2: Great.
- 3: Favorite, add post to favorites.
Raises: PybooruAPIError
– When score is > 3.
-
tag_list
(**params)¶ Get a list of tags.
Parameters: - name (str) – The exact name of the tag.
- id (int) – The id number of the tag.
- limit (int) – How many tags to retrieve. Setting this to 0 will return every tag (Default value: 0).
- page (int) – The page number.
- order (str) – Can be ‘date’, ‘name’ or ‘count’.
- after_id (int) – Return all tags that have an id number greater than this.
-
tag_update
(name=None, tag_type=None, is_ambiguous=None)¶ Action to lets you update tag (Requires login) (UNTESTED).
Parameters: - name (str) – The name of the tag to update.
- tag_type (int) –
- General: 0.
- artist: 1.
- copyright: 3.
- character: 4.
- is_ambiguous (int) – Whether or not this tag is ambiguous. Use 1 for True and 0 for False.
Get a list of related tags.
Parameters: - tags (str) – The tag names to query.
- type (str) – Restrict results to this tag type. Can be general, artist, copyright, or character.
-
artist_list
(**params)¶ Get a list of artists.
Parameters: - name (str) – The name (or a fragment of the name) of the artist.
- order (str) – Can be date or name.
- page (int) – The page number.
-
artist_create
(name, urls=None, alias=None, group=None)¶ Function to create an artist (Requires login) (UNTESTED).
Parameters: - name (str) – The artist’s name.
- urls (str) – A list of URLs associated with the artist, whitespace delimited.
- alias (str) – The artist that this artist is an alias for. Simply enter the alias artist’s name.
- group (str) – The group or cicle that this artist is a member of. Simply:param enter the group’s name.
-
artist_update
(artist_id, name=None, urls=None, alias=None, group=None)¶ Function to update artists (Requires Login) (UNTESTED).
Only the artist_id parameter is required. The other parameters are optional.
Parameters: - artist_id (int) – The id of thr artist to update (Type: INT).
- name (str) – The artist’s name.
- urls (str) – A list of URLs associated with the artist, whitespace delimited.
- alias (str) – The artist that this artist is an alias for. Simply enter the alias artist’s name.
- group (str) – The group or cicle that this artist is a member of. Simply enter the group’s name.
-
artist_destroy
(artist_id)¶ Action to lets you remove artist (Requires login) (UNTESTED).
Parameters: artist_id (int) – The id of the artist to destroy.
-
comment_show
(comment_id)¶ Get a specific comment.
Parameters: comment_id (str) – The id number of the comment to retrieve.
-
comment_create
(post_id, comment_body, anonymous=None)¶ Action to lets you create a comment (Requires login).
Parameters: - post_id (int) – The post id number to which you are responding.
- comment_body (str) – The body of the comment.
- anonymous (int) – Set to 1 if you want to post this comment anonymously.
-
comment_destroy
(comment_id)¶ Remove a specific comment (Requires login).
Parameters: comment_id (int) – The id number of the comment to remove.
-
wiki_list
(**params)¶ Function to retrieves a list of every wiki page.
Parameters: - query (str) – A word or phrase to search for (Default: None).
- order (str) – Can be: title, date (Default: title).
- limit (int) – The number of pages to retrieve (Default: 100).
- page (int) – The page number.
-
wiki_create
(title, body)¶ Action to lets you create a wiki page (Requires login) (UNTESTED).
Parameters: - title (str) – The title of the wiki page.
- body (str) – The body of the wiki page.
-
wiki_update
(title, new_title=None, page_body=None)¶ Action to lets you update a wiki page (Requires login) (UNTESTED).
Parameters: - title (str) – The title of the wiki page to update.
- new_title (str) – The new title of the wiki page.
- page_body (str) – The new body of the wiki page.
-
wiki_show
(**params)¶ Get a specific wiki page.
Parameters: - title (str) – The title of the wiki page to retrieve.
- version (int) – The version of the page to retrieve.
-
wiki_destroy
(title)¶ Function to delete a specific wiki page (Requires login) (Only moderators) (UNTESTED).
Parameters: title (str) – The title of the page to delete.
-
wiki_lock
(title)¶ Function to lock a specific wiki page (Requires login) (Only moderators) (UNTESTED).
Parameters: title (str) – The title of the page to lock.
-
wiki_unlock
(title)¶ Function to unlock a specific wiki page (Requires login) (Only moderators) (UNTESTED).
Parameters: title (str) – The title of the page to unlock.
-
wiki_revert
(title, version)¶ Function to revert a specific wiki page (Requires login) (UNTESTED).
Parameters: - title (str) – The title of the wiki page to update.
- version (int) – The version to revert to.
-
wiki_history
(title)¶ Get history of specific wiki page.
Parameters: title (str) – The title of the wiki page to retrieve versions for.
-
note_list
(**params)¶ Get note list.
Parameters: post_id (int) – The post id number to retrieve notes for.
-
note_search
(query)¶ Search specific note.
Parameters: query (str) – A word or phrase to search for.
-
note_history
(**params)¶ Get history of notes.
Parameters: - post_id (int) – The post id number to retrieve note versions for.
- id (int) – The note id number to retrieve versions for.
- limit (int) – How many versions to retrieve (Default: 10).
- page (int) – The note id number to retrieve versions for.
-
note_revert
(note_id, version)¶ Function to revert a specific note (Requires login) (UNTESTED).
Parameters: - note_id (int) – The note id to update.
- version (int) – The version to revert to.
-
note_create_update
(post_id=None, coor_x=None, coor_y=None, width=None, height=None, is_active=None, body=None, note_id=None)¶ Function to create or update note (Requires login) (UNTESTED).
Parameters: - post_id (int) – The post id number this note belongs to.
- coor_x (int) – The X coordinate of the note.
- coor_y (int) – The Y coordinate of the note.
- width (int) – The width of the note.
- height (int) – The height of the note.
- is_active (int) – Whether or not the note is visible. Set to 1 for active, 0 for inactive.
- body (str) – The note message.
- note_id (int) – If you are updating a note, this is the note id number to update.
-
user_search
(**params)¶ Search users.
If you don’t specify any parameters you’ll _get a listing of all users.
Parameters: - id (int) – The id number of the user.
- name (str) – The name of the user.
-
forum_list
(**params)¶ Function to get forum posts.
If you don’t specify any parameters you’ll _get a listing of all users.
Parameters: parent_id (int) – The parent ID number. You’ll return all the responses to that forum post.
-
pool_list
(**params)¶ Function to get pools.
If you don’t specify any parameters you’ll get a list of all pools.
Parameters: - query (str) – The title.
- page (int) – The page number.
-
pool_posts
(**params)¶ Function to get pools posts.
If you don’t specify any parameters you’ll get a list of all pools.
Parameters: - id (int) – The pool id number.
- page (int) – The page number.
-
pool_update
(pool_id, name=None, is_public=None, description=None)¶ Function to update a pool (Requires login) (UNTESTED).
Parameters: - pool_id (int) – The pool id number.
- name (str) – The name.
- is_public (int) – 1 or 0, whether or not the pool is public.
- description (str) – A description of the pool.
-
pool_create
(name, description, is_public)¶ Function to create a pool (Require login) (UNTESTED).
Parameters: - name (str) – The name.
- description (str) – A description of the pool.
- is_public (int) – 1 or 0, whether or not the pool is public.
-
pool_destroy
(pool_id)¶ Function to destroy a specific pool (Require login) (UNTESTED).
Parameters: pool_id (int) – The pool id number.
-
pool_add_post
(**params)¶ Function to add a post (Require login) (UNTESTED).
Parameters: - pool_id (int) – The pool to add the post to.
- post_id (int) – The post to add.
-
pool_remove_post
(**params)¶ Function to remove a post (Require login) (UNTESTED).
Parameters: - pool_id (int) – The pool to remove the post to.
- post_id (int) – The post to remove.
-
favorite_list_users
(post_id)¶ Function to return a list with all users who have added to favorites a specific post.
Parameters: post_id (int) – The post id.