Skip to main content

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

Metadata

Release files for pgserviceparser 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgserviceparser 2.0.0
File Size Uploaded
pgserviceparser-2.0.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pgserviceparser 2.0.0
File Interpreter ABI Platform
pgserviceparser-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / pgserviceparser-2.0.0.tar.gz

Download URL pgserviceparser-2.0.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
df33541cc38eb71b0d96e288b791953912fb1874f031a9fd806002a463324926
BLAKE2b-256 checksum
How to use checksums
88c5dafd615e7d4d43d4b5eb20d058675e31ab5e73c437dce882a2d4b60988e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / pgserviceparser-2.0.0-py3-none-any.whl

Download URL pgserviceparser-2.0.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6293bcb7b67f55e74b1d20466cec6940adf4ee9131473b117bfeb903afaf3244
BLAKE2b-256 checksum
How to use checksums
bd4b7ba05c9342a41f279465ab332d3df7300ea0dfbefc562e6c312af2a25f41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

This release

2.0.0 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page