xsnippet logotype

xsnippet

test [ Python ]

by Guest /
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$ python
Python 2.7.14 (default, Sep 23 2017, 22:06:14)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from jarvis.service.config import Configuration
>>>
>>> c = Configuration()
>>> c.conf.keys()
['directory_pool', 'app_path', 'github', 'logging', 'slack', 'service', 'database', 'base_url', 'abort_jenkins_builds_on_pr_update', 'jenkins', 'suites_path', 'abort_on_update_whitelist']
>>> c['database']
[{'username': 'pguser', 'host': 'localhost', 'name': 'default', 'database': 'jarvis', 'password': 'pgpass', 'driver': 'postgresql', 'port': 5432}]
>>> 'database' in c
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/artempanchenko/projects/jarvis/jarvis/service/config.py", line 84, in __getitem__
    return self.conf[key]
KeyError: 0