A package that helps to query the [API](https://krdict.korean.go.kr/openApi/openApiInfo) of the
[Korean Learners' Dictionary](https://krdict.korean.go.kr/mainAction), provided by the National Institute of Korean Language.
## Installation
To install the package via pip, run:
```
pip install krdict.py
```
You can also install from one of the [GitHub releases](https://github.com/omarkmu/krdict.py/releases).
## Usage
To use most of the functionality provided by this package, you'll need to generate an API key via
[the portal](https://krdict.korean.go.kr/openApi/openApiRegister) (requires login).
A minimal example query that assumes the `KRDICT_KEY` environment variable is set:
```python
import os
import json
import krdict
krdict.set_key(os.getenv('KRDICT_KEY'))
response = krdict.search(query='나무', raise_api_errors=True)
print(json.dumps(response.asdict(), indent=2, ensure_ascii=False))
```
Assuming an error does not occur, the output will be similar to:
```json
{
"data": {
...
"results": [
{
"target_code": 32750,
"word": "나무",
"pronunciation": "나무",
...
"definitions": [
{
"order": 1,
"definition": "단단한 줄기에 가지와 잎이 달린, 여러 해 동안 자라는 식물."
},
...
]
},
...
]
},
"request_params": {
"q": "나무",
"key": "YOUR_API_KEY"
}
}
```
For more information and usage examples, please check the [documentation](https://krdictpy.readthedocs.io/en/v3.0.2).
Raw data
{
"_id": null,
"home_page": "https://github.com/omarkmu/krdict.py#readme",
"name": "krdict.py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "korean dictionary api",
"author": "Omar M.",
"author_email": "omarkmu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1d/bf/ababd57bd7d5d16e669ce7c8a3349ca2871d9e43e72e760ad7f335922c0a/krdict.py-3.0.2.tar.gz",
"platform": null,
"description": "A package that helps to query the [API](https://krdict.korean.go.kr/openApi/openApiInfo) of the\r\n[Korean Learners' Dictionary](https://krdict.korean.go.kr/mainAction), provided by the National Institute of Korean Language.\r\n\r\n## Installation\r\n\r\nTo install the package via pip, run:\r\n\r\n```\r\npip install krdict.py\r\n```\r\n\r\nYou can also install from one of the [GitHub releases](https://github.com/omarkmu/krdict.py/releases).\r\n\r\n## Usage\r\nTo use most of the functionality provided by this package, you'll need to generate an API key via\r\n[the portal](https://krdict.korean.go.kr/openApi/openApiRegister) (requires login).\r\n\r\nA minimal example query that assumes the `KRDICT_KEY` environment variable is set:\r\n\r\n```python\r\nimport os\r\nimport json\r\nimport krdict\r\n\r\nkrdict.set_key(os.getenv('KRDICT_KEY'))\r\nresponse = krdict.search(query='\ub098\ubb34', raise_api_errors=True)\r\n\r\nprint(json.dumps(response.asdict(), indent=2, ensure_ascii=False))\r\n```\r\n\r\nAssuming an error does not occur, the output will be similar to:\r\n\r\n```json\r\n{\r\n \"data\": {\r\n ...\r\n \"results\": [\r\n {\r\n \"target_code\": 32750,\r\n \"word\": \"\ub098\ubb34\",\r\n \"pronunciation\": \"\ub098\ubb34\",\r\n ...\r\n \"definitions\": [\r\n {\r\n \"order\": 1,\r\n \"definition\": \"\ub2e8\ub2e8\ud55c \uc904\uae30\uc5d0 \uac00\uc9c0\uc640 \uc78e\uc774 \ub2ec\ub9b0, \uc5ec\ub7ec \ud574 \ub3d9\uc548 \uc790\ub77c\ub294 \uc2dd\ubb3c.\"\r\n },\r\n ...\r\n ]\r\n },\r\n ...\r\n ]\r\n },\r\n \"request_params\": {\r\n \"q\": \"\ub098\ubb34\",\r\n \"key\": \"YOUR_API_KEY\"\r\n }\r\n}\r\n```\r\n\r\nFor more information and usage examples, please check the [documentation](https://krdictpy.readthedocs.io/en/v3.0.2).\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A package that helps with querying the Korean Learners' Dictionary API.",
"version": "3.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/omarkmu/krdict.py/issues",
"Documentation": "https://krdictpy.readthedocs.io/en/v3.0.2",
"Homepage": "https://github.com/omarkmu/krdict.py#readme",
"Source Code": "https://github.com/omarkmu/krdict.py"
},
"split_keywords": [
"korean",
"dictionary",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c8ea575a9054dd990b59aa09ad830072e42d260c56cd54ad14b40a9db1343cd7",
"md5": "dfa9edc2ec393267e677c9c9f18eb131",
"sha256": "5b1bf7c45c8e8f876c3311ccd425fea96344b4beb0c9856ef25bbad489afd989"
},
"downloads": -1,
"filename": "krdict.py-3.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dfa9edc2ec393267e677c9c9f18eb131",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 57148,
"upload_time": "2024-06-02T18:22:37",
"upload_time_iso_8601": "2024-06-02T18:22:37.563455Z",
"url": "https://files.pythonhosted.org/packages/c8/ea/575a9054dd990b59aa09ad830072e42d260c56cd54ad14b40a9db1343cd7/krdict.py-3.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1dbfababd57bd7d5d16e669ce7c8a3349ca2871d9e43e72e760ad7f335922c0a",
"md5": "281e0279d057d96580050b03d34c4d88",
"sha256": "0e12d0992c4c2a689075a494f4047f205b6760100b53057a0d924681bcf8759c"
},
"downloads": -1,
"filename": "krdict.py-3.0.2.tar.gz",
"has_sig": false,
"md5_digest": "281e0279d057d96580050b03d34c4d88",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 51929,
"upload_time": "2024-06-02T18:22:39",
"upload_time_iso_8601": "2024-06-02T18:22:39.281151Z",
"url": "https://files.pythonhosted.org/packages/1d/bf/ababd57bd7d5d16e669ce7c8a3349ca2871d9e43e72e760ad7f335922c0a/krdict.py-3.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-02 18:22:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "omarkmu",
"github_project": "krdict.py#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "cssselect",
"specs": [
[
">=",
"1.2.0"
]
]
},
{
"name": "lxml",
"specs": [
[
">=",
"4.9.4"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.32.3"
]
]
}
],
"lcname": "krdict.py"
}