Skip to main content

Working with WaniKani API, login, and Community.

Project description

# How to use WaniKaniTools

[![Build Status](](
[![PyPI version](](
[![PyPI license](](
[![PyPI pyversions](](
[![PyPI status](](

The following operations are supported by WaniKaniTools

* API v1 wrapper
* API v2 wrapper, and support for pagination
* Web login, and community login using `requests`
* Web login using `Chrome / Firefox` and able to both `execute_script()` and `click()` buttons accordingly

Sample working scripts are in `example/`. See also `tests/`.

## Installation

`pip install WaniKaniTools`

## Using API v1

from WaniKaniTools import api

resource = (
'recent-unlocks', # Argument is output limit in range 1-100. Default=10
'critical-items', # Argument is percentage in range 0-100. Default=75
'radicals', # Argument is level, comma-delimited. Default=all levels
api_v1 = api.APIv1(put_your_api_v1_key_here)
result = api_v1.GET(resource[2])['requested_information'] # Output is Python dictionary

## Using API v2

### Basic operations

from WaniKaniTools import api

resource_v2 = (
'subjects', # Argument is id. Params are ids, types, slugs, levels, updated_after
'assignments', # Argument is id. Params are ...
api_v2 = api.APIv2(put_your_api_v2_key_here)
result = api_v2.GET(resource_v2[1]) # Output is Python dictionary

### Pagination

from WaniKaniTools import api

api_v2 = api.APIv2(put_your_api_v2_key_here)
result = api_v2.GET('subjects')

while True:
for data in result['data']:
meaning_array = []
for meaning in data["data"]["meanings"]:
if meaning['primary']:
meaning_array += [ meaning['meaning'] ]

to_print = (
data["data"]["characters"] if "characters" in data["data"] else data["data"]["character"],
', '.join(meaning_array),

next_url = result['pages']['next_url']

if next_url is None:

result = api_v2.GETurl(next_url)

## Simulating web login

### Web login with requests

This is possible for most operations, including Discourse API, Burn Manager.

from WaniKaniTools.login import Requests
s = Requests(your_username, your_password).session

### Web login and execute script

The operations supported here are the same as `selenium-webdriver`. Default uses Firefox's Geckodriver.

from WaniKaniTools.login import Webdriver

with Webdriver(your_username, your_password) as w:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for WaniKaniTools, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size WaniKaniTools-0.3.0-py2.py3-none-any.whl (6.0 kB) File type Wheel Python version 3.6 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page