'type' (e.g 'onyomi') missing from kanji readings for v2 API call?

(update: as Gorbit99 notes, the issue I describe below is a peculiarity of the python implementation rather than an API issue. I’ve been able to work around this issue by going into the _raw data like this:
kanji[0]._raw[‘data’][‘readings’][0][‘type’]).

Hi there I’m downloading all kanji readings, and have noticed that while I have all of the readings, it doesn’t download the ‘type’ field for each reading entry for a given kanji. For example according to this (WaniKani API Reference) each reading entry should have a ‘type’ and a ‘reading’ entry, so that one could classify a reading as onyomi, kunyomi or other. But when I download the kanji as below the ‘type’ info isn’t contained. Any thoughts?

in other words the reading entry looks like this:

{'reading': 'いち', 'primary': True, 'accepted_answer': True}

But according to the API reference it should look like this:

{'reading': 'いち', 'primary': True, 'accepted_answer': True, 'type': 'onyomi'}

Here’s the exact python code (minus API key) below.

from wanikani_api.client import Client
v2_api_key = "xxxxxxxxxxxxxxxxxxxxxx"
client = Client(v2_api_key)
kanji = client.subjects(types="kanji", fetch_all=True)
test_reading = kanji[0].readings[0]
print(test_reading.reading)  # return -> 'いち'
print(test_reading.type) # returns -> 'AttributeError: 'Reading' object has no attribute 'type''

Something’s not right there, I tried to do it in JS and I did get the type value:
image

Edit: if you’re using the wanikani_api python lib, then it does have an issue, that has been open since 2020:

Maybe it’s worth pinging the issue again

5 Likes