An asynchronous wrapper in python for the https://dictionaryapi.dev API
Project description
NOTE: Currently I have only implemented fetching words from English, not other languages. This is because the actual API's implementation of languages other than english is different. Support for different languages coming soon though.
Requirements
- Python 3.6+
- aiohttp
Features
- Asynchronous
- Typed
- Full API coverage
- Organized Responses
Installation
Available through PyPi (pip)
$ pip install asyncdictionary
Or through git.
$ pip install git+https://github.com/Ay-355/asyncdictionary
Note: if these don't work then try using prefixing them with either
py -m
orpython -m
Documentation
As this isn't that big of a lib, the docs are a simple markdown file located here.
Issues
Any issues directly with the API should be reported at the API's repository page.
If there is anything wrong with this package, feel free to open up an issue and explain what happened.
Examples
An example to print out some information about a word
import asyncdictionary
import asyncio
# create an instance of the client
dictionary = asyncdictionary.Client()
async def word_info(word):
word = await dictionary.get_word(word) # get a Word object
print(f"Word: {word.word}")
print(f"Phonetic text: {word.phonetics[0].text}")
print(f"Part of Speech: {word.meanings[0].part_of_speech}")
print(f"Definition: {word.meanings[0].definitions[0].definition}")
print(f"Synonyms: {', '.join(word.meanings[0].definitions[0].synonyms)}")
print(f"Example: {word.meanings[0].definitions[0].example}")
asyncio.run(word_info("hello"))
Links
License
Todo
-
Add dunder methods (
__str__
&__repr__
) to all dataclasses. -
Use less dataclasses to make it simpler for end user.
-
Add support for non english languages.
- Might require rewrite of classes to support missing attributes.
-
Add some more examples, preferably one in a discord bot.
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
Built Distribution
Hashes for asyncdictionary-1.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a57ee1f4073e61f9be0a68e9c6ce3140dee78a91287471d81eb234301c86a81 |
|
MD5 | 26f03af2ea2eaf72be6923248aae4e5d |
|
BLAKE2b-256 | 0400df48e0aea0e29d0a1fa234b7cbb6fdf5b7e18c20366a5145f96d4f7227a9 |