forked from dunossauro/live-de-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.py
More file actions
32 lines (27 loc) · 830 Bytes
/
Copy pathsimple.py
File metadata and controls
32 lines (27 loc) · 830 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
from configparser import ConfigParser
from requests import get
d = {'verbose': 0,
'url': 'http://google.com',
'port': 8080,
'bananas': 'pijamas'}
e = {'verbose': 0,
'url': 'http://google.com',
'port': 8080,
'bananas': 'pijamas'}
config = ConfigParser(d,
allow_no_value=True,
delimiters=('=', ':', '-'),
comment_prefixes=('#', ';'),
inline_comment_prefixes='#',
strict=False,
)
config['DEFAULT'] = e
config.read('example.ini')
default_config = dict(config['default'])
xpto_config = dict(config['xpto'])
xpto2_config = dict(config['xpto2'])
print(default_config)
print(xpto_config)
print(xpto2_config)
print(default_config['url'],
get(default_config['url']))