Skip to main content

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>

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-1.0.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgserviceparser-1.0.2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file pgserviceparser-1.0.2.tar.gz.

File metadata

  • Download URL: pgserviceparser-1.0.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pgserviceparser-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3f263216dc7611a5ddc038aa7281d0c938722bc2a8ad3790b3a0a91f9670d589
MD5 3a9fcd9d4db1ff25d4adfc195caf9a88
BLAKE2b-256 89f1dab5291347d14e7cee62121301ef50881776a2302676d73ed087f3db3432

See more details on using hashes here.

File details

Details for the file pgserviceparser-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pgserviceparser-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 83f694b4559ec9d178456a151102cdbeeb76b8ef7fea1cc898c8eeb39b026840
MD5 8680e40f02cd0e948d93e1ba9ab13941
BLAKE2b-256 294744c45d191009dbf2a2818911822b9121dd23265d210d6eb96b608cb6d9ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page