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
package
python setup.py sdist
test
pytest
or
pyton -m unittest
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
Built Distribution
File details
Details for the file klang-globconf-0.0.6.tar.gz
.
File metadata
- Download URL: klang-globconf-0.0.6.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1df9e074ef2cb46f300d32a4737e093c0746c30174a6493c2aef5767d6e6791c |
|
MD5 | 0d989ac17f13db24c01ffabb82002d24 |
|
BLAKE2b-256 | 239a83aa7732114a0d7e4fb21e2f54cef0d77b696e8878df2dfa5ba44679d6c4 |
File details
Details for the file klang_globconf-0.0.6-py2.py3-none-any.whl
.
File metadata
- Download URL: klang_globconf-0.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa8c3a7bdb5db32ee49bdec833978f383f05fa054c4fb7a6bd1436e59819df1e |
|
MD5 | ace4575897f64f39edffcf9fc247c5f0 |
|
BLAKE2b-256 | bdbca839a11a7e30649c329ba070821cc926f18fea156ec2f2bc4ce242858b16 |