Skip to content

STiago/Python-JSON-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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