Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
example_program.py
module.py
requirements.txt
tests.py

README.md

Python-JSON-Template

Task

Write a python module that can receive a JSON string and if the action is “apply” it adds the contents of the “template” into a priority queue. The module also processes the queue every second and saves the template to a file.

Example JSON string:

{“action”: “apply”, “when”: “2016-4-19 10:00:00”, “template”: …}

Solution

Documentation here

Module that can receive a JSON string and if the action is "apply" it adds the contents of the "template" field into a priority queue.

I also included an example program that describes how to use the module.

How to run the example program: ./example_program.py
How to run the tests: ./tests.py

Before running this program and its tests please execute the following commands: 
    - virtualenv env
    - env/bin/pip install -r requirements.txt

Code licensed by GNU GENERAL PUBLIC LICENSE Version 3.

Text licensed by Creative Commons Attribution-ShareAlike 4.0 International.

GPL-3.0 CC-BY-SA-4.0