What's the deal with asyncio?
Project description
aioseinfeld
What's the deal with asyncio?
Install
$ pip install aioseinfeld
Depends on having a copy of the script database generated using scripts by Colin Pollick.
You can build your own copy using those scripts, or download a prebuilt copy with the following command:
$ wget https://noswap.com/pub/seinfeld.db
Usage
aioseinfeld uses context managers to wrap the underlying sqlite database connection.
Create the Seinfeld
object by passing the path to the seinfeld.db
database:
from aioseinfeld import Seinfeld
async with Seinfeld(db_path) as seinfeld:
...
Get information on individual episodes or seasons:
async with Seinfeld(db_path) as seinfeld:
season = await seinfeld.season(1)
episodes = await season.episodes
episodes[0].title # "Good News, Bad News"
episodes[0].writers # ["Jerry Seinfeld"]
episodes[0].date # date(1990, 6, 14)
Quotes can be retrieved by unique ID:
async with Seinfeld(db_path) as seinfeld:
quote = await seinfeld.quote(34665)
quote.speaker.name # "George"
quote.episode.title # "The Pitch"
quote.text # "The show is about nothing."
Quotes can also be found by searching:
async with Seinfeld(db_path) as seinfeld:
await seinfeld.search(speaker="Jerry", subject="keys") # [Quote(...), ...]
You can even get random quotes with optional search parameters:
async with Seinfeld(db_path) as seinfeld:
await seinfeld.random() # Quote(...)
await seinfeld.random(subject="parking") # Quote(...)
If you want more context around a quote, passages help:
async with Seinfeld(db_path) as seinfeld:
quote = await seinfeld.random()
passage = await seinfeld.passage(quote, length=5)
passage.quotes # [Quote(...), ...]
License
aiomultiprocess is copyright John Reese, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to
my code is from me and not from my employer. See the LICENSE
file for details.
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
Hashes for aioseinfeld-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d82294d52350a7c2c540dc88d5d5a154b6566942fb482d21e919e9d507023bb |
|
MD5 | a83dfd92099c1596c2f2f3a45c11bbfd |
|
BLAKE2b-256 | 4b2318c2f7473aadae678f8fcf6ba1d5f668e2e593feff8053cb3fcf9d82ea27 |