From 2b407d1f4a608d0ac23592ff16def77797e4fa41 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 31 Mar 2020 20:12:34 +0200 Subject: init thesaurus api client --- cli/app/utils/util.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 cli/app/utils/util.py (limited to 'cli/app/utils/util.py') diff --git a/cli/app/utils/util.py b/cli/app/utils/util.py new file mode 100644 index 0000000..5f72088 --- /dev/null +++ b/cli/app/utils/util.py @@ -0,0 +1,15 @@ +import simplejson as json +from hashlib import sha256 + +def sha256(s): + sha256 = hashlib.sha256() + sha256.update(s) + return sha256.hexdigest() + +def read_json(fn): + with open(fn, 'r') as json_file: + return json.load(json_file) + +def write_json(fn, data): + with open(fn, 'w') as outfile: + json.dump(data, outfile) -- cgit v1.2.3-70-g09d2