Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

udpy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

udpy

Urban dictionary API wrapper for Python

  • 2.0.0
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc