-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfparse.py
More file actions
39 lines (28 loc) · 894 Bytes
/
confparse.py
File metadata and controls
39 lines (28 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
class ConfigParser:
def __init__(self, dbm, svc, config):
with open(config,'r') as f:
conf = json.loads(f.read())
if dbm != None and svc != None:
self.host = conf[dbm][svc]['host']
self.port = conf[dbm][svc]['port']
self.db = conf[dbm][svc]['db']
self.user = conf[dbm][svc]['user']
self.word = conf[dbm][svc]['word']
self.emailto = conf['emailto']
self.emailfrom = conf['emailfrom']
del conf
def get_host(self):
return self.host
def get_port(self):
return self.port
def get_user(self):
return self.user
def get_pass(self):
return self.word
def get_db(self):
return self.db
def get_emailto(self):
return self.emailto
def get_emailfrom(self):
return self.emailfrom