GithubHelp home page GithubHelp logo

joke's Introduction

joke

PyPI Python Version Wheel Implementation Downloads License

Jokes for python.

I was really sad, no package called joke. So I decided to create one, really fast. This package have some functions, that return some jokes, quotes or facts. If you are sad, use the joke packages. :)

Install

pip install axju-jokes

Command line

You can exit the function from the command line. There are two entry points:

$ joke
$ python -m joke

With no arguments, it will return a random joke, quote or fact. You can set one specifically API. For example some cat facts:

$ joke cat

Use help to see the possible API's:

$ joke --help

Examples

Some jokes examples

from joke.jokes import *
# This will import all joke-functions (geek, icanhazdad, chucknorris, icndb)
# Now you can use them to get some jokes.

# For example you can display 10 Chuck Norris jokes.
for i in range(10):
    print(chucknorris())

# Or get a random joke-function.
from random import choice
print(choice([geek, icanhazdad, chucknorris, icndb])())

Some quotes examples

from joke.quotes import *

# get a quote from quotesondesign.com
print(quotesondesign())

# you can get more then one with one request
for quote in quotesondesign(5):
    print(quote)

# and you can get the data
data = quotesondesign(format='data')
print(data['quote'])
print(data['author'])


# get quote from stormconsultancy.co.uk
print(stormconsultancy())

# You can set the ID to get a specific quote
print(stormconsultancy(id=2))

# the stormconsultancy-function give you also the data
data =stormconsultancy(id=2, format='data')
print(data['quote'])
print(data['author'])

Check also the example folder.

Import Easter Egg

>>> import joke.eggs
Chuck Norris has to register every part of his body as a separate lethal weapon.
His spleen is considered a concealed weapon in over 50 states.

API's

To get the jokes, I use some open API's. If you know some missing API's, please contact me. Until now, the following API's are used.

Development

Clone repo:

git clone https://github.com/axju/joke.git

Create virtual environment for Linux:

python3 -m venv venv
source venv/bin/activate

Create virtual environment for Windows:

python -m venv venv
.\venv\Scripts\activate

Update dev-tools:

python -m pip install --upgrade wheel pip setuptools twine tox flake8 coverage pytest pylint

Install local:

python -m pip install -e .

Run some tests:

tox
python -m coverage run --branch --source lying -m pytest
python -m coverage report

Publish the packages:

git tag -a 1.0.3 -m '1.0.3'
git push origin 1.0.3
python setup.py --version
python setup.py check
python setup.py sdist bdist_wheel
twine upload dist/*

joke's People

Contributors

axju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.