diff options
Diffstat (limited to 'jsonfactory.py')
| -rw-r--r-- | jsonfactory.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jsonfactory.py b/jsonfactory.py index 6703ef2..c57b430 100644 --- a/jsonfactory.py +++ b/jsonfactory.py @@ -2,10 +2,15 @@ import json class JSONFactory(object): + """Factory class to create JSON messages to be sent to the shoutbox API""" running_id = 1 @staticmethod def make_object(text, user, timestamp, ip): + """ + Create a JSON object from the passed parameters and + add a running id + """ message = json.dumps({ "id": JSONFactory.running_id, "text": text, @@ -18,4 +23,5 @@ class JSONFactory(object): @staticmethod def make_array(object_list): + """Create a JSON array from a list of JSON objects""" return "[\n" + ",\n".join(object_list) + "\n]" |
