diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-03-31 20:12:34 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-03-31 20:12:34 +0200 |
| commit | 2b407d1f4a608d0ac23592ff16def77797e4fa41 (patch) | |
| tree | 44d7b146d56d083e9d1c9fd2979831ea14d19334 /cli/app/utils/util.py | |
init thesaurus api client
Diffstat (limited to 'cli/app/utils/util.py')
| -rw-r--r-- | cli/app/utils/util.py | 15 |
1 files changed, 15 insertions, 0 deletions
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) |
