gmr / pgpasslib

Library for getting passwords from a PostgreSQL Password file

Home Page:http://pgpasslib.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pgpasslib

pgpasslib is a library for retrieving passwords from a PostgreSQL password file, either from a location specified in the PGPASSFILE environment variable or in the .pgpass file in the current user's home directory.

Version Downloads Status Coverage Code Climate

Installation

pgpasslib may be installed via the Python package index with the tool of your choice. I prefer pip:

pip install pgpasslib

Documentation

https://pgpasslib.readthedocs.org

Requirements

There are no requirements outside of the Python standard library.

Example

The following example will attempt to get the password for PostgreSQL running on localhost:5432 to the postgres database as the postgres user.

import pgpasslib

password = pgpasslib.getpass('localhost', 5432, 'postgres', 'postgres')
if not password:
    raise ValueError('Did not find a password in the .pgpass file')

Version History

Available at https://pgpasslib.readthedocs.org

About

Library for getting passwords from a PostgreSQL Password file

http://pgpasslib.readthedocs.org

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%