global configparser object to be used across modules
Project description
globconf
Creates a global configparser object, regardless of the project and module in need of it
Getting Started
In project:
from globconf import config
# config will attempt to read local config.ini file if present - otherwise:
if 'important section' not in config.sections():
config.read_string("""
[important section]
host = critical-system.com
user = REST_USER
pwd = REST_PASSWORD
verify_ssl = false
""")
# or config.read('some_other_config.ini')
# load class using globconf.config
In modules:
from globconf import config, verify_required_options
class module(object):
def __init__(self):
sec = 'service now'
self.cfg = verify_required_options(sec, ['host', 'user', 'pwd'])
if not self.cfg.getboolean('verify_ssl', fallback=True):
import urllib3
urllib3.disable_warnings(InsecureRequestWarning)
And your module is happy as long as someone has initialised the needed section in the global config.
Prerequisites
configparser
Installing
A step by step series of examples that tell you how to get a development env running
Give the example
And repeat
until finished
End with an example of getting some data out of the system or using it for a little demo
Authors
- Steffen Schumacher - Initial work - steffenschumacher
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Hat tip to anyone whose code was used
- Inspiration
- etc
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
klang-globconf-0.0.5.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for klang_globconf-0.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f900b2f6611a0f3eb05c976595453835e30da98e4076d14ec18b5c706a565956 |
|
MD5 | 824d4487b2c8734de0d3b77b46ea3218 |
|
BLAKE2b-256 | d5f7b0de07b1835676ec23606d390d86f47f6f38038aa9943d382f42c5f59969 |