aboutsummaryrefslogtreecommitdiff
path: root/bcst/resource.py
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2020-04-22 07:39:07 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2020-04-22 07:39:07 +0200
commita7217345e1cf9fa878e271fcc199f9a18eb9637f (patch)
tree638d5bcc4e4388ebcb08c9e75ced9d759bb1f3f4 /bcst/resource.py
parent5c0cc8e2f4fd632445079abc7af1b65ca0d3a8e0 (diff)
Debug package
Diffstat (limited to 'bcst/resource.py')
-rw-r--r--bcst/resource.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/bcst/resource.py b/bcst/resource.py
new file mode 100644
index 0000000..342e08a
--- /dev/null
+++ b/bcst/resource.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+from os import path
+import json
+
+
+class Resource:
+ def __init__(self, resource):
+ self.resource=resource
+ # Read data
+ try:
+ with open(resource,'r') as f:
+ self.data=f.read()
+ except IOError:
+ print("Unable to found "+resource)
+ exit(1)
+ # Decode data
+ try:
+ self.json=json.loads(self.data)
+ except:
+ print("Unable to read json from "+resource)
+ exit(1)
+