Skip to main content
# How to use WaniKaniTools

[![Build Status](https://travis-ci.org/patarapolw/WaniKaniTools.svg?branch=master)](https://travis-ci.org/patarapolw/WaniKaniTools)
[![PyPI version shields.io](https://img.shields.io/pypi/v/WaniKaniTools.svg)](https://pypi.python.org/pypi/WaniKaniTools/)
[![PyPI license](https://img.shields.io/pypi/l/WaniKaniTools.svg)](https://pypi.python.org/pypi/WaniKaniTools/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/WaniKaniTools.svg)](https://pypi.python.org/pypi/WaniKaniTools/)
[![PyPI status](https://img.shields.io/pypi/status/WaniKaniTools.svg)](https://pypi.python.org/pypi/WaniKaniTOols/)

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

```python
from WaniKaniTools import api

resource = (
'user-information',
'study-queue',
'level-progression',
'srs-distribution',
'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
'kanji',
'vocabulary'
)
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

```python
from WaniKaniTools import api

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

### Pagination

```python
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["id"],
data["object"],
data["data"]["characters"] if "characters" in data["data"] else data["data"]["character"],
', '.join(meaning_array),
data["data"]["document_url"]
)
print(*to_print)

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

if next_url is None:
break

result = api_v2.GETurl(next_url)
```

## Simulating web login

### Web login with requests

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

```python
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.

```python
from WaniKaniTools.login import Webdriver

with Webdriver(your_username, your_password) as w:
w.driver.execute_script(put_your_javascript_here)
```

Metadata

Release files for WaniKaniTools 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for WaniKaniTools 0.3.0
File Interpreter ABI Platform Actions
WaniKaniTools-0.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for WaniKaniTools-0.3.0-py2.py3-none-any.whl

Release files / WaniKaniTools-0.3.0-py2.py3-none-any.whl

Download URL WaniKaniTools-0.3.0-py2.py3-none-any.whl
Size 6.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3dcece64e8bd68feb0cedb5de1e281bbaffcc8c310e722c0f274098f1fd61520
BLAKE2b-256 checksum
How to use checksums
b83fb09863c26be76d0e5e02e63a41360f866df96d66dbd1a89a9e65ec2180ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for WaniKaniTools 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page