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 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
To run use poetry. Invoke:
$ cd funny-endpoints
$ poetry run funny
To build for docker invoke:
docker-compose build
To run the application in docker invoke:
docker-compose up -d
$ curl http://localhost:5000/v1/advice
{"message":"If you don't want something to be public, don't post it on the Internet."}
$ 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"}
$ curl http://localhost:5000/v1/dadjoke
{"message":"What do you call an eagle who can play the piano? Talonted!"}
$ 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."}