A package parsing the PostgreSQL connection service file
Project description
pgserviceparser
A python package parsing the PostgreSQL connection service file.
>>> import pgserviceparser
Finding the PostgreSQL connection service file with conf_path
Returns the path found for the pg_service.conf on the system as string.
>>> pgserviceparser.conf_path()
'/home/dave/.pg_service.conf'
Listing all the services with service_names
Returns all service names in a list.
Optionally you can pass a config file path. Otherwise it gets it by conf_path
.
>>> pgserviceparser.service_names()
['srvce_wandplaene', 'ktn_solothurn', 'daves_bakery']
Receiving the configuration for a service with service_config
Returns the config from the given service name as a dict.
Optionally you can pass a config file path. Otherwise it gets it by conf_path
.
>>> pgserviceparser.service_config('daves_bakery')
{'host': 'localhost', 'port': '5432', 'dbname': 'bakery', 'user': 'dave', 'password': 'fischersfritz'}
Getting the full configuration with full_config
Returns full pgservice config as configparser.ConfigParser().
Optionally you can pass a config file path. Otherwise it gets it by conf_path
.
>>> pgserviceparser.full_config()
<configparser.ConfigParser object at 0x7f4c6d66b580>
Contribute
Git hooks
pip install pre-commit
pre-commit install
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
pgserviceparser-2.1.0.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for pgserviceparser-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cc50efde0e1c08202562cfefaea33928b9d8faac39ceb3d5e955dd061e243d6 |
|
MD5 | 9c90582df3659d88b02e67a67e3d22ea |
|
BLAKE2b-256 | fe6a65e1e13ff25a6bf1ff639704e46861f34278acd31a04fb65ac26b4ea8e73 |