Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Please consider changing the behavior of getpass #4

Description

@troelsy

First off, this is really a handy tool, I use it a lot, so thank you for making it easy to retrieve the password for Postgres.

... but, I lost a couple of hours last time at work, because of the behavior of getpass, when no match is found. I had misspelled the url in .pgpass, which then returns None as documented:

Return the password for the specified host, port, dbname and user. None will be returned if a
password can not be found for the specified connection parameters.

Although, I didn't know this was expected behavior. I would have assumed some kind of exception, if the password was not found. I think you should consider throwing an exception instead, because I can't see a situation where returning None would be a useful. You would catch a lot of errors like mine this way, and if you really want None, you can just make a try-except.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions