-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
71 lines (59 loc) · 1.68 KB
/
config.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# This file is part of android-permissions and licensed under The MIT License (MIT).
import ConfigParser # read_config
class Config():
def read_config(self):
config = ConfigParser.ConfigParser()
config.read('config.ini')
# General
if config.get('General', 'crawlers') == '':
print 'ERROR: crawlers not set'
print_usage()
exit()
else:
self.crawlers = int(config.get('General', 'crawlers'))
if config.get('General', 'processors') == '':
print 'ERROR: processors not set'
print_usage()
exit()
else:
self.processors = int(config.get('General', 'processors'))
# Market
if config.get('Market', 'market_url') == '':
print 'ERROR: market_url not set'
print_usage()
exit()
else:
self.market_url = config.get('Market', 'market_url')
if config.get('Market', 'app_url') == '':
print 'ERROR: app_url not set'
print_usage()
exit()
else:
self.app_url = config.get('Market', 'app_url')
# Database
if config.get('Database', 'host') == '':
print 'ERROR: Database host not set'
print_usage()
exit()
else:
self.db_host = config.get('Database', 'host')
if config.get('Database', 'user') == '':
print 'ERROR: Database user not set'
print_usage()
exit()
else:
self.db_user = config.get('Database', 'user')
if config.get('Database', 'password') == '':
print 'ERROR: Database password not set'
print_usage()
exit()
else:
self.db_password = config.get('Database', 'password')
if config.get('Database', 'database') == '':
print 'ERROR: Database database not set'
print_usage()
exit()
else:
self.db_database = config.get('Database', 'database')
return