Skip to content

Simple python-application that interacts with different open api's to create text that you can receive on GET endpoints.

License

Notifications You must be signed in to change notification settings

dllg/py-funny-endpoints

Repository files navigation

CI

Funny endpoints

Simple python-application that interacts with different open api's to create text that you can receive on GET endpoints. See swagger.yml.

It uses poetry for dependency management, flask for the web server and requests for the http requests.

Testing

Testing is done using pytest. Testing of funny.py is done using dependency injection. Mocking of requests is done in requester_mock.py.

Testing of router.py is done using flask test_client.

To run the tests invoke:

poetry run pytest

Running

To run use poetry. Invoke:

$ cd funny-endpoints
$ poetry run funny

Docker

Building

To build for docker invoke:

docker-compose build

Running

To run the application in docker invoke:

docker-compose up -d

Examples of using it

Get an advice

$ curl http://localhost:5000/v1/advice
{"message":"If you don't want something to be public, don't post it on the Internet."}

Get a Chuck Norris Joke

$ curl http://localhost:5000/v1/chucknorris
{"message":"there is no use crying over spilled milk, unless its Chuck Norris' milk because then your gonna die"}

Get a dad joke

$ curl http://localhost:5000/v1/dadjoke
{"message":"What do you call an eagle who can play the piano? Talonted!"}

Get a random message

$ curl http://localhost:5000/v1/random
{"message":"Advice: When painting a room, preparation is key. The actual painting should account for about 40% of the work."}

About

Simple python-application that interacts with different open api's to create text that you can receive on GET endpoints.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published