
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
naver-dict-api
Advanced tools
A Python library for accessing Naver Dictionary APIs with support for multiple language dictionaries including Hanja (漢字), Korean, English, Japanese, Chinese, and more.
curl-cffi for robust HTTP requests with browser impersonationpip install naver-dict-api
from naver_dict_api import search_dict, DictType
# Search Hanja (Chinese characters)
entry = search_dict("漢", DictType.HANJA)
if entry:
print(f"Word: {entry.word}")
print(f"Reading: {entry.reading}")
print(f"Meanings: {', '.join(entry.meanings)}")
# Search Korean
entry = search_dict("안녕", DictType.KOREAN)
# Search English
entry = search_dict("hello", DictType.ENGLISH)
from naver_dict_api import NaverDictClient, DictType, SearchMode
# Create a client instance
client = NaverDictClient(
dict_type=DictType.HANJA,
search_mode=SearchMode.DETAILED
)
# Search for a word
entry = client.search("漢")
if entry:
print(entry.to_dict())
from naver_dict_api import DictType
DictType.HANJA # 漢字 (Chinese characters)
DictType.KOREAN # 국어 (Korean)
DictType.ENGLISH # 영어 (English)
DictType.JAPANESE # 일본어 (Japanese)
DictType.CHINESE # 중국어 (Chinese)
DictType.GERMAN # 독일어 (German)
DictType.FRENCH # 프랑스어 (French)
DictType.SPANISH # 스페인어 (Spanish)
DictType.RUSSIAN # 러시아어 (Russian)
DictType.VIETNAMESE # 베트남어 (Vietnamese)
DictType.ITALIAN # 이탈리아어 (Italian)
DictType.THAI # 태국어 (Thai)
DictType.INDONESIAN # 인도네시아어 (Indonesian)
DictType.UZBEK # 우즈베키스탄어 (Uzbek)
search_dict()Convenience function for quick dictionary lookups.
def search_dict(
query: str,
dict_type: DictType = DictType.HANJA,
search_mode: SearchMode = SearchMode.SIMPLE,
*,
impersonate: BrowserTypeLiteral | None = "chrome136",
timeout: int | None = None,
) -> DictEntry | None
Parameters:
query: Search termdict_type: Dictionary type (default: HANJA)search_mode: Search mode (default: SIMPLE)impersonate: Browser to impersonate (default: "chrome136")timeout: Request timeout in seconds (default: 30)Returns: DictEntry object or None if not found
NaverDictClientMain client class for dictionary searches.
client = NaverDictClient(
dict_type=DictType.HANJA,
search_mode=SearchMode.SIMPLE,
impersonate="chrome136",
timeout=30
)
entry = client.search("query")
DictEntryData class representing a dictionary entry.
Attributes:
word: The word or characterreading: Pronunciation or readingmeanings: List of meanings/definitionsentry_id: Unique entry identifierdict_type: Dictionary type codeMethods:
to_dict(): Convert to dictionary formatThe library provides specific exceptions for different error cases:
from naver_dict_api import (
NaverDictError, # Base exception
NetworkError, # Network-related errors
ParseError, # JSON parsing errors
InvalidResponseError # Invalid API response
)
try:
entry = search_dict("test")
except NetworkError:
print("Network connection failed")
except ParseError:
print("Failed to parse response")
except InvalidResponseError:
print("Invalid response from API")
# Clone the repository
git clone https://github.com/yourusername/naver-dict-api.git
cd naver-dict-api
# Install dependencies with uv
uv sync
# Install in development mode
uv pip install -e .
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=naver_dict_api
# Run only unit tests (skip integration tests)
uv run pytest -m "not integration"
# Build distribution packages
uv build
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
This library uses the Naver Dictionary autocomplete API and is not officially affiliated with Naver Corporation.
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.