A module which helps with querying the KRDict API.
Project description
krdict.py
A python module which helps to query the API of the Korean Learner's Dictionary, provided by the National Institute of Korean Language. Inspired by krdict.js.
Installation
To install the module via pip, run:
pip install krdict.py
To use this module, you'll need to generate an API key via krdict (requires login).
Usage
A minimal example query which assumes the KRDICT_KEY
environment variable is set:
import os
import json
import krdict
krdict.set_key(os.getenv('KRDICT_KEY'))
response = krdict.search_words(query='나무', raise_api_errors=True)
print(json.dumps(response, indent=2, ensure_ascii=False))
Assuming an error does not occur, the output will be similar to:
{
"data": {
...
"results": [
{
"target_code": 32750,
"word": "나무",
"pronunciation": "나무",
...
"definitions": [
{
"order": 1,
"definition": "단단한 줄기에 가지와 잎이 달린, 여러 해 동안 자라는 식물."
},
...
]
},
...
]
},
"request_params": {
"q": "나무",
"key": "YOUR_API_KEY"
}
}
For more information, please check the documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
krdict.py-1.0.4.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for krdict.py-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a2e6ab59bf657b07c7689aa1dde98a91eaf4342460049241fb09771eab4b0e5 |
|
MD5 | f42b3b6183553f16704f2e97339ea331 |
|
BLAKE2b-256 | 2765880bc962b10b04ec0ce8e0471925f732433ba072d09787cd7101b6902030 |