Python wrapper for the Urban Dictionary API.
Project description
python-urbandict
This is a python project, that fetches definitions of words from urban dictionary's public API.
Future additions. PRs are always welcome :)
- Calculate ratio of
thumbs_upandthumbs_downand decide the probability of a correct definition.
Installation
Python 3.9 or higher is required
To install the library you can use the following command:
# Linux/MacOS
python3 -m pip install --upgrade python-urbandict
# Windows
py -3 -m pip install --upgrade python-urbandict
Or just try:
pip install python-urbandict
Quick Example
You can create an instance of the UrbanDict class and pass a word to it. After that you can use the search method that will retrieve the definitions from UrbanDictionary.
If you want to you can also leave the word attribute empty, in which case a random word is selected by UrbanDictionary.
from pyurbandict import UrbanDict
word = UrbanDict("python")
results = word.search()
print(results[0])
>>> Definition(
word='python',
definition='The best thing to happen to [Computer Science] students in a data and [file] structures or [algorithms] class.',
example='Joe: "Man...I spent a week coding that [algorithm] in C."\r\nMoe: "I got it [done in one] evening with [Python]. It works great."\r\nJoe: "Say, what? Where can I download that?"',
author='TheNextBillGates',
thumbs_up=243,
thumbs_down=71,
sound_urls=['https://api.twilio.com/2008-08-01/Accounts/ACd09691b82112e4b26fce156d7c01d0ed/Recordings/RE7065a4ef810937cc16ae2b6e4b54b67d'],
written_on='2010-03-24T05:24:18.000Z',
permalink='http://python.urbanup.com/4826760',
defid=4826760,
current_vote=''
)
Links
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_urbandict-0.3.14.tar.gz.
File metadata
- Download URL: python_urbandict-0.3.14.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b4755760b83a8f0e5266ed2869927c45291d7411e44e38c53f7933214cd7768
|
|
| MD5 |
2886052a52f1fc2de01d475dd6f0fde9
|
|
| BLAKE2b-256 |
dcbf6195872868f20fb2af2b142791a4d727715831450475b06009ec53bb38a0
|
File details
Details for the file python_urbandict-0.3.14-py3-none-any.whl.
File metadata
- Download URL: python_urbandict-0.3.14-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d616b9fb420c50711277e276c8b74de7c24aae1ae68780e1b24f9566dbc26587
|
|
| MD5 |
3113d6ad9c48512852af8be34ca50c31
|
|
| BLAKE2b-256 |
dd8099fa121163c9c7b288d9d85034582ac3786803417c4dc7243ff35a997cb2
|