Urban dictionary API wrapper for Python
Project description
urbandictionary-py
Simple Python wrapper for Urban Dictionary API.
Installation
With PyPI:
pip install udpy
Usage
UrbanDefinition
This module defines UrbanDefinition, an object to represent each Urban Dictionary definition. UrbanDefinition has the following accessible attributes:
- word: the word being defined,
- definition: the word's definition,
- example: usage example,
- upvotes: number of upvotes on Urban Dictionary,
- downvotes: number of downvotes on Urban Dictionary
Examples
Create client:
from udpy import UrbanClient
client = UrbanClient()
Lookup by word:
defs = client.get_definition('netflix and chill')
> [List of UrbanDef objects]
Lookup random words:
rand = client.get_random_definition()
> [List of UrbanDef objects]
Read definitions:
for d in defs:
print(d.definition)
> It means that you are going to go over ...
> code for two people going to each others ...
> <other Netflix and Chill definitions> ...
UrbanDefinition string representation:
for d in defs:
print(d)
> Netflix and Chill: It means that you are going to go over to your par... (21776, 7750)
> netflix and chill: code for two people going to each others houses an... (8056, 2622)
> <word>: <definition trimmed to 50 characters> (<upvotes>, <downvotes>)
Also it has asynchronous interface. Just use AsyncUrbanClient and add awaits.
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 udpy-2.0.0.tar.gz.
File metadata
- Download URL: udpy-2.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Linux/5.4.24-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0026abf16b2a616bd9a10ceb0d3d2a49b046aa53295fd6d2735ad051cc7271e
|
|
| MD5 |
ca802ea98f3729fe3d741167d10802a7
|
|
| BLAKE2b-256 |
306af042fa77b28e29ea59803816e14e43c16859341d2305b5fa07e0f5191413
|
File details
Details for the file udpy-2.0.0-py3-none-any.whl.
File metadata
- Download URL: udpy-2.0.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Linux/5.4.24-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f1e45d346af1f63b648bbd06b9a44f5b930b8a7c8cc21ddada383ea3e26cb1b
|
|
| MD5 |
bb4ca0cfae5f494b969647a3d527fcdc
|
|
| BLAKE2b-256 |
a8385e41a06a565915084bb8dddc6efa9c86f69d99dc9d6ebbb946773ba7d256
|