Skip to main content

API Wrapper for sv443's joke api

Project description

JokeAPI Wrapper by TheWever

Import jokeapie

import jokepie # imports package

Create a client

client = jokepie.Client() # returns client objects

Get a joke

joke = client.get_joke() # returns Joke object

Post a joke

client.upload_joke('Insert Joke', 'category') # returns True on exception

Sample:

import jokepie
client = jokepie.Client()
joke = client.get_joke('dog')
print(joke.joke)

Docs

Joke Objetct:

  • Category # returns
  • joke_type # returns str
  • joke # returns str or list
  • flags # returns list
  • id # returns int
  • safe # return bool
  • language / lang # returns str
  • request # returns req resp object
  • get_joke() # returns joke or dict

Client Object:

  • get_joke(content='', lang='english', categories: list=['any'], blacklist=[], joke_type='single', safe_mode=False, id_range=[], amount: int = 1) # returns Joke Object
  • upload_joke(joke: str or dict, category, joke_type='single', lang='english', on_flags=[]) # returns bool

--

Notes:

Given Args

Most arguments are not required but should be checked especially before uploading a joke

Sequence Matcher

When you provide an invalid argument like inglish as language the best match will be choosen using SequenceMatcher

Uploading jokes

When you want to upload a joke of the type twopart provide a list[setup, delivery] as joke else str(joke)

Updates and async

This libary will not recive any updates only patches and is not asynchronous

Project details


Download files

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

Source Distribution

jokepie-1.0.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

jokepie-1.0.5-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file jokepie-1.0.5.tar.gz.

File metadata

  • Download URL: jokepie-1.0.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for jokepie-1.0.5.tar.gz
Algorithm Hash digest
SHA256 752abfe103990e941f532b46b21bff09d782ddef801cacc32f96d8efd65180bf
MD5 1c2f128feb3587f8007ec45a3ece6010
BLAKE2b-256 baa36d82c96185d3560eb6be71f6b90e3babf1c8a7a9bba29e729ea45f5306f7

See more details on using hashes here.

File details

Details for the file jokepie-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: jokepie-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for jokepie-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f57c4e66643619c551b794e91b05d21d680d67d0ab3eba2ddaf37bf9e455f210
MD5 2a1af79a078219f277abf55e7dabc028
BLAKE2b-256 e1bcf4a65898cb3cad045e0c1ee440af2d77b5ae21450bc297fe7d2ad1e9c5f5

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