Skip to main content

An asynchronous wrapper around the UrbanDictionary API.

Project description

Documentation Status pypi

Yet another UrbanDictionary API wrapper.

AsyncUrban is a non-blocking library, using asyncio and aiohttp, which can be used to access UrbanDictionary data.

Installation

Make sure you have Python3.5+ and run py -3 -m pip install asyncurban for Windows, or python3 -m pip install asyncurban for most other things.

Documentation

You can find the docs at http://asyncurban.readthedocs.io/ and a brief example below.

Examples

>>> import asyncio
>>> from asyncurban import UrbanDictionary
>>> loop = asyncio.get_event_loop()

# session and loop are optional kwargs for your convenience if
# You already have them defined for your project
>>> urban = UrbanDictionary(loop=loop)

# Get a word definition
>>> word = loop.run_until_complete(urban.get_word('dank'))
>>> word.definition
'Also an expression requently used by stoners and hippies for something of high quality.'

# Get a random word
>>> random_word = loop.run_until_complete(urban.get_random())
>>> print(random_word)
Orgasm
>>> random_word.definition
"When a woman reaches their 'climax'. It is the most desirable feeling EVER. Its like an explosion inside the body that feels so good."

# You can even search for X matching words and get a list
# The default is 3 but can be specified
>>> word_list = loop.run_until_complete(urban.search('test', limit=5))
>>> print(word_list)
[<Word word=test defid=708924>, <Word word=test defid=2957653>, <Word word=test defid=2573364>, <Word word=test defid=1876232>, <Word word=test defid=1662552>]
>>> word_list[0].definition
'A process for testing things'

Issues

Feel free to open up an issue or submit a PR if you have trouble or see a way to improve the code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

asyncurban-0.3.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file asyncurban-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for asyncurban-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 21cc7cbceb5f255a1e35827bb28d3625ed23fb129cc68f3d39ff62a18b609655
MD5 a9845bd66fb232b4ffffaff2bd9ac38d
BLAKE2b-256 9e24b6b3e12edf60b4c13ca18fdf9ed4a6f774e64f7eb87a142498a66cd5f6a2

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