Skip to main content

Wrapper for Free Dictionary API https://dictionaryapi.dev/

Project description

PyPI PyPI - Python Version PyPI - Downloads Read the Docs API`s working PyPI - License GitHub issues

python-freeDictionaryAPI is a wrapper for Free Dictionary API.

Library is simple, light and uses very cool fully free dictionary API.

Library components can be used with high level API (clients) or if you wish so you can use only some implemented parts that you`re interested in (like URL generating, parsers, …).

Implemented synchronous and asynchronous clients that powered with httpx and aiohttp accordingly.

If you do not prefer to use implemented clients and want to use some other web lib. So, it is synchronous and asynchronous base clients for inheriting. All you need it is to implement one method that makes HTTP request.

You can read the docs here.

Installation

$ pip install python-freeDictionaryAPI

To install package with extra requirements for one of the client:

  • for synchronous client that uses httpx:

$ pip install python-freeDictionaryAPI[sync-client]
  • for asynchronous client that uses aiohttp:

$ pip install python-freeDictionaryAPI[async-client]

Super Quick Start

>>> from freedictionaryapi.clients.sync_client import DictionaryApiClient
>>> with DictionaryApiClient() as client:
...     parser = client.fetch_parser('hello')
>>> word = parser.word
>>> word.word
'hello'
>>> word.phonetics
[Phonetic(text='/həˈloʊ/', audio='https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3'), Phonetic(text='/hɛˈloʊ/', audio='https://lex-audio.useremarkable.com/mp3/hello_us_2_rr.mp3')]
>>> for meaning in word.meanings:
...     print(meaning.part_of_speech)
...     for definition in meaning.definitions:
...             orint(definition)
...     print()
noun
Definition(definition='An utterance of “hello”; a greeting.', example='she was getting polite nods and hellos from people', synonyms=['greeting', 'welcome', 'salutation', 'saluting', 'hailing', 'address', 'hello', 'hallo'])

intransitive verb
Definition(definition='Say or shout “hello”; greet someone.', example='I pressed the phone button and helloed', synonyms=None)

exclamation
Definition(definition='Used as a greeting or to begin a phone conversation.', example='hello there, Katie!', synonyms=None)
>>> parser.get_transcription()
'/həˈloʊ/'
>>> parser.get_link_on_audio_with_pronunciation()
'https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3'
>>> parser.get_all_definitions()
['An utterance of “hello”; a greeting.', 'Say or shout “hello”; greet someone.', 'Used as a greeting or to begin a phone conversation.']
>>> parser.get_all_synonyms()
['hello', 'hailing', 'welcome', 'address', 'salutation', 'hallo', 'saluting', 'greeting']
>>> parser.get_all_examples()
['she was getting polite nods and hellos from people', 'I pressed the phone button and helloed', 'hello there, Katie!']

API note

API that used in this library does not provide present of all fields in response.

So, be aware, when response is parsed and some of the fields are empty in result - in code they`ll be returning None.

Developer

Good luck!

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

python-freeDictionaryAPI-0.9.10.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

python_freeDictionaryAPI-0.9.10-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file python-freeDictionaryAPI-0.9.10.tar.gz.

File metadata

  • Download URL: python-freeDictionaryAPI-0.9.10.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for python-freeDictionaryAPI-0.9.10.tar.gz
Algorithm Hash digest
SHA256 51e068b4eef46545525004d5e2b534d96b0c372098950cb72ed8fefb00a8846a
MD5 1eab09eed3735022a6ee950881606ead
BLAKE2b-256 db6bea708756a58009d98130cdab74d278c0fb02642903f758cd752f805faa48

See more details on using hashes here.

File details

Details for the file python_freeDictionaryAPI-0.9.10-py3-none-any.whl.

File metadata

  • Download URL: python_freeDictionaryAPI-0.9.10-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for python_freeDictionaryAPI-0.9.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b061f1fde50769e84b50a85e778f48fd326abdb1d152049d688830f53aa2a852
MD5 d5c445fbe29f8cec0869b8d33dbf7f51
BLAKE2b-256 3e326a627966c140944a4e38a3f89f7f37f342fc5129c2f39a3082b911aa628c

See more details on using hashes here.

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