File: verify_json.py

package info (click to toggle)
privacybadger 2020.10.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 7,044 kB
  • sloc: javascript: 50,267; python: 1,741; sh: 454; makefile: 32
file content (18 lines) | stat: -rw-r--r-- 411 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3

import json
import sys

KEYS = set(['snitch_map', 'action_map', 'version'])

with open(sys.argv[1]) as f:
    try:
        js = json.load(f)
        if set(js.keys()) == KEYS:
            sys.exit(0)
        else:
            print("json keys %s are not correct" % js.keys())
            sys.exit(1)
    except Exception as e:
        print("error parsing json:", e)
        sys.exit(1)