Skip to main content

mwdictionary

Small wrapper around the Merriam-Webster API. Has both a sync and async interface thanks to httpx.

Installation

pip install mwdictionary

Usage

Using mwdictionary's sync interface:

>>> from mwdictionary import MWClient
>>> client = MWClient(key="YOUR-KEY-HERE")
>>> client.get("python")
Word(word='python', wordtype='noun', shortdef='as in anaconda, boa', synonyms=['adder', 'anaconda', 'asp', 'black racer', 'blacksnake', 'blue racer', 'boa', 'bull snake', 'bushmaster', 'chicken snake', 'cobra', 'constrictor', 'copperhead', 'coral snake', 'cottonmouth moccasin', 'diamondback rattlesnake', 'fer-de-lance', 'garter snake', 'gopher snake', 'green snake', 'hognose snake', 'horned viper', 'indigo snake', 'king cobra', 'king snake', 'krait', 'mamba', 'milk snake', 'moccasin', 'pine snake', 'pit viper', 'puff adder', 'racer', 'rat snake', 'rattlesnake', 'sea serpent', 'sea snake', 'sidewinder', 'taipan', 'water moccasin', 'water snake', 'worm snake', 'serpent', 'snake', 'viper'], antonyms=[], stems='python')

Using the async interface:

>>> import asyncio
>>> asyncio.run(client.aget("python"))
Word(word='python', wordtype='noun', shortdef='as in anaconda, boa', synonyms=['adder', 'anaconda', 'asp', 'black racer', 'blacksnake', 'blue racer', 'boa', 'bull snake', 'bushmaster', 'chicken snake', 'cobra', 'constrictor', 'copperhead', 'coral snake', 'cottonmouth moccasin', 'diamondback rattlesnake', 'fer-de-lance', 'garter snake', 'gopher snake', 'green snake', 'hognose snake', 'horned viper', 'indigo snake', 'king cobra', 'king snake', 'krait', 'mamba', 'milk snake', 'moccasin', 'pine snake', 'pit viper', 'puff adder', 'racer', 'rat snake', 'rattlesnake', 'sea serpent', 'sea snake', 'sidewinder', 'taipan', 'water moccasin', 'water snake', 'worm snake', 'serpent', 'snake', 'viper'], antonyms=[], stems='python')

If you want the word as a dictionary, just pass the result to dataclasses.asdict():

>>> from dataclasses import asdict
>>> asdict(client.get("python"))
{'word': 'python', 'wordtype': 'noun', 'shortdef': 'as in anaconda, boa', 'synonyms': ['adder', 'anaconda', 'asp', 'black racer', 'blacksnake', 'blue racer', 'boa', 'bull snake', 'bushmaster', 'chicken snake', 'cobra', 'constrictor', 'copperhead', 'coral snake', 'cottonmouth moccasin', 'diamondback rattlesnake', 'fer-de-lance', 'garter snake', 'gopher snake', 'green snake', 'hognose snake', 'horned viper', 'indigo snake', 'king cobra', 'king snake', 'krait', 'mamba', 'milk snake', 'moccasin', 'pine snake', 'pit viper', 'puff adder', 'racer', 'rat snake', 'rattlesnake', 'sea serpent', 'sea snake', 'sidewinder', 'taipan', 'water moccasin', 'water snake', 'worm snake', 'serpent', 'snake', 'viper'], 'antonyms': [], 'stems': 'python'}

Metadata

Release files for mwdictionary 0.1.2

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

Source distribution (sdist)

Source distribution for mwdictionary 0.1.2
File Size Uploaded Provenance Actions
mwdictionary-0.1.2.tar.gz 3.2 kB Without provenance Details for mwdictionary-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mwdictionary 0.1.2
File Interpreter ABI Platform Actions
mwdictionary-0.1.2-py3-none-any.whl Python 3 none any Details for mwdictionary-0.1.2-py3-none-any.whl

Total release size: 6.5 kB

Release files / mwdictionary-0.1.2.tar.gz

Download URL mwdictionary-0.1.2.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e324aadbe1111990d0d289024a7f9aa4eabe20c17467fdf887b6e3883f31f94
BLAKE2b-256 checksum
How to use checksums
564ff319e3a1f2063492875836c69547b136d4c5a2ea742fb573b0730d282266
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0 CPython/3.7.0 Windows/10

Release files / mwdictionary-0.1.2-py3-none-any.whl

Download URL mwdictionary-0.1.2-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
381c48bd8aa15817b1199f1072207c40377875a92fa7c74a5a5eabdaf10aa303
BLAKE2b-256 checksum
How to use checksums
cfc99786ccf0fe3d7cbaac02ec25835a95069f2101bb3213204a5cc84080a5c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0 CPython/3.7.0 Windows/10

Security for mwdictionary 0.1.2

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