Client Module¶
-
class
wanikani_api.client.
Client
(v2_api_key, subject_cache_enabled=False)[source]¶ This is the only object you can instantiate. It provides access to each relevant API endpoint on Wanikani.
-
assignment
(assignment_id)[source]¶ Get a single
models.Assignment
by its known idParameters: assignment_id – the id of the assignment Returns: a single models.Assignment
-
assignments
(ids=None, created_at=None, subject_ids=None, subject_types=None, levels=None, available_before=None, available_after=None, srs_stages=None, unlocked=None, started=None, passed=None, burned=None, resurrected=None, hidden=None, updated_after=None, fetch_all=False)[source]¶ Assignments are the association between a user, and a subject. This means that every time something is added to your lessons, a new
models.Assignment
is created.Parameters: - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- ids (int[]) – Return only results with the given IDs
- created_at – Timestamp when resource was created
- subject_ids (int[]) – Return only :class:`.models.Assignment`s which are tied to the given subject_ids
- subject_types (str[]) – The specific
models.Subject
types you wish to retrieve. Possible values are:["kanji", "vocabulary", "radicals"]
- levels (int[]) – Include only
models.Assignment
where the subjects are from the specified levels. - available_before (datetime) – Return assignment reviews available before timestamp
- available_after (datetime) – Return assignment reviews available after timestamp
- srs_stages (int) – Return assignments of specified srs stages. Note, 0 is lessons, 9 is the burned state
- unlocked (bool) – Return assignments which have unlocked (made available to lessons)
- started (bool) – Return assignments which move from lessons to reviews
- passed (bool) – Return assignments which have reach Guru (aka srs_stage 5) at some point (true) or which have never been Guru’d (false)
- burned (bool) – Return assignments which have been burned at some point (true) or never have been burned (false)
- resurrected (bool) – Return assignments which either have been resurrect (true) or not (false)
- hidden (bool) – Return assignments which are or are not hidden from the user-facing application
- updated_after (datetime) – Return results which have been updated after the timestamp
Returns: An iterator over a set of
models.Page
where the data contained is allmodels.Assignment
-
level_progression
(level_progression_id)[source]¶ Get a single
models.LevelProgression
by its known idParameters: level_progression_id – the id of the level_progression Returns: a single models.LevelProgression
-
level_progressions
(ids=None, updated_after=None, fetch_all=False)[source]¶ Retrieve all
models.LevelProgression
for a given user.Parameters: - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- ids (int[]) – Return only results with the given IDs
- updated_after (datetime) – Return results which have been updated after the timestamp
Returns: An iterator over all
models.LevelProgression
for a given user.
-
reset
(reset_id)[source]¶ Get a single
models.Reset
by its known idParameters: reset_id – the id of the reset Returns: a single models.Reset
-
resets
(ids=None, updated_after=None, fetch_all=False)[source]¶ Retrieve information for all resets the user has performed on Wanikani.
Parameters: - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- ids (int[]) – Return only results with the given IDs
- updated_after (datetime) – Return results which have been updated after the timestamp
Returns: An iterator over all
models.Reset
for a given user.
-
review
(review_id)[source]¶ Get a single
models.Review
by its known idParameters: review_id – the id of the review Returns: a single models.Review
-
review_statistic
(review_statistic_id)[source]¶ Get a single
models.ReviewStatistic
by its known idParameters: review_statistic_id – the id of the review_statistic Returns: a single models.ReviewStatistic
-
review_statistics
(ids=None, subject_ids=None, subject_types=None, updated_after=None, percentages_greater_than=None, percentages_less_than=None, hidden=None, fetch_all=False)[source]¶ Retrieve all Review Statistics from Wanikani. A Review Statistic is related to a single subject which the user has studied.
Parameters: - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- ids (int[]) – Return only results with the given IDs
- subject_ids (int[]) – Return only :class:`.models.Assignment`s which are tied to the given subject_ids
- subject_types (str[]) – The specific
models.Subject
types you wish to retrieve. Possible values are:["kanji", "vocabulary", "radicals"]
- updated_after (datetime) – Return results which have been updated after the timestamp
- percentages_greater_than (int) – Return results where the percentage_correct is greater than the value. [0-100]
- percentages_less_than (int) – Return results where the percentage_correct is less than the value. [0-100]
- hidden (bool) – Return only results where the related subject has been hidden.
Returns: An iterator which contains all Review Statistics
-
reviews
(ids=None, subject_ids=None, updated_after=None, fetch_all=False)[source]¶ Retrieve all reviews for a given user. A
models.Review
is a single instance of this user getting a single review correctly submitted.Parameters: - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- ids (int[]) – Return only results with the given IDs
- subject_ids (int[]) – Return only :class:`.models.Assignment`s which are tied to the given subject_ids
- updated_after (datetime) – Return results which have been updated after the timestamp
Returns: An iterator over all
models.Review
for a given user.
-
study_material
(study_material_id)[source]¶ Get a single
models.StudyMaterial
by its known idParameters: study_material_id – the id of the study material Returns: a single models.StudyMaterial
-
study_materials
(ids=None, subject_ids=None, subject_types=None, hidden=None, updated_after=None, fetch_all=False)[source]¶ Retrieve all Study Materials. These are primarily meaning notes, reading notes, and meaning synonyms.
Parameters: - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- ids (int[]) – Return only results with the given IDs
- subject_ids (int[]) – Return only :class:`.models.Assignment`s which are tied to the given subject_ids
- subject_types (str[]) – The specific
models.Subject
types you wish to retrieve. Possible values are:["kanji", "vocabulary", "radicals"]
- hidden (bool) – Return only results where the related subject has been hidden.
- updated_after (datetime) – Return results which have been updated after the timestamp
Returns: An iterator over all Study Materials
-
subject
(subject_id)[source]¶ Get a single subject by its known id
Parameters: subject_id – the id of the subject Returns: a single models.Subject
. This might be either: *models.Radical
*models.Kanji
*models.Vocabulary
-
subjects
(ids=None, types=None, slugs=None, levels=None, hidden=None, updated_after=None, fetch_all=False)[source]¶ Retrieves Subjects
Wanikani refers to Radicals, Kanji, and Vocabulary as Subjects. This function allows you to fetch all of the subjects, regardless of the current level of the account that the API key is associated to. All parameters to this function are optional, and are for filtering the results. are ignored, and the subject with that ID in question is fetched.
Parameters: - ids (int[]) – Filters based on a list of IDs. Does not cause other parameters to be ignored.
- types (str[]) – The specific
models.Subject
types you wish to retrieve. Possible values are:["kanji", "vocabulary", "radicals"]
- slugs (str[]) – The wanikani slug
- levels (int[]) – Include only
models.Subject
from the specified levels. - hidden (bool) – Return
models.Subject
which are or are not hidden from the user-facing application - fetch_all (bool) – if set to True, instead of fetching only first page of results, will fetch them all.
- updated_after (
datetime.datetime
) – Return results which have been updated after the timestamp
Returns: An iterator over multiple
models.Page
, in which thedata
field contains a list anything that is amodels.Subject
, e.g.:
-
user_information
()[source]¶ Gets all relevant information about the user.
Raises: exceptions.InvalidWanikaniApiKeyException
Return type: models.UserInformation
-