Skip to main content

A module which helps with querying the KRDict API.

Reason this release was yanked:

Development version

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='나무')

print(json.dumps(response, indent=2, ensure_ascii=False))

Assuming an error is not returned, this would print something like:

{
  "data": {
    ...
    "results": [
      {
        "target_code": 32750,
        "word": "나무",
        "pronunciation": "나무",
        "link": "https://krdict.korean.go.kr/dicSearch/SearchView?ParaWordNo=32750",
        "meaning": [
          {
            "definition": "단단한 줄기에 가지와 잎이 달린, 여러 해 동안 자라는 식물.",
            "order": 1
          },
          ...
        ],
        "part_of_speech": "명사",
        "vocabulary_grade": "초급",
        "homograph_num": 0
      },
      ...
    ],
    "num_results": 10,
    "start_index": 1,
    "total_results": 53,
    "last_build_date": "20211001061204"
  },
  "request_params": {
    "q": "나무",
    "key": "YOUR_API_KEY"
  }
}

Project details


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-0.0.3.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

krdict.py-0.0.3-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page