Write a terminal application in Python 3 to get a random or user-specified picture from https://http.cat/ with following abilities:
- get a random status or get user-defined status (via command-line flag; random is default)
- save it locally in temporary directory
- and open said image in user's browser
Also program should have:
- Logging of actions, should log WARN by default with cmdline flag to increase level to DEBUG (-v)
- Linting enabled and passed
- Auto-formatting enabled with black
- setup.py installation script to install it on *NIX system
Possible command line flags:
./httpcat.py a program to get cat picture for a http status
-h show this help
-v increase logging to DEBUG level
-s (--status) specify http status to get (DONT forget validation!!)
To open a browser with a picture save it as .jpg file and use open $path_to_file
Completed work should be presented as github/bitbucket repo. If time allows you can also research CI solutions for your platform and implement simple pipeline which would:
- create a virtualenv with all dependencies (use venv/virtualenv/pipenv)
- run a test (yes, you have to write one :)
- build a package with setup.py
- celebrate!
Alternatively all pipeline above can either be expressed as bash
script or a Makefile
.