Skip to main content

Python library and script to access the API of the pleasant password server.

Project description

pypleasant

pypleasant is a Python script and library which interfaces with the API of Pleasant Password Server.

pleasant-cli /path/to/entry --password  # print an entry's password
pleasant-cli /path/to/entry --attachments secret_file.txt  # download an attachment
pleasant-cli /path/to/entry --custom-field test  # print value of a custom field

Requirements

pypleasant requires Python >= 3.6 and is only compatible with Pleasant Password Server API v5.

Installation

pypleasant is available on PyPi and can be easily installed via pip:

pip install pypleasant

In order to use the command-line client pleasant-cli, ensure that your PATH variable includes Python's bin directory (adapt if necessary):

export PATH+=$PATH:$HOME/.local/bin

Use the --help switch to check whether everything is setup correctly:

pleasant-cli --help

Alternatively, pypleasant can be executed as a Python module without modifying the PATH variable:

python -m pypleasant --help

Configuration

pleasant-cli prompts the user for missing login information required for the Pleasant API. This information can be configured (partially or completely) using command-line parameters or environment variables:

  • --api-url or PYPLEASANT_API_URL
  • --api-user or PYPLEASANT_API_USER
  • --api-password (NOT RECOMMENDED) or PYPLEASANT_API_PASSWORD

In case self-signed certificates are used, consider disabling the HTTPS certificate check via --disable-cert-check or by setting PYPLEASANT_DISABLE_CERT_CHECK=true.

Usage

Print entry attributes:

pleasant-cli /path/to/entry --username
pleasant-cli /path/to/entry --password
pleasant-cli /path/to/entry --url

Access a custom field's value:

pleasant-cli /path/to/entry --custom-field test

Download attachments (defaults to the current directory):

pleasant-cli /path/to/entry --attachments  # downloads all attachments
pleasant-cli /path/to/entry --attachments secret_file.txt
pleasant-cli /path/to/entry --attachments file_1.txt file_2.txt --download-dir /path/to/download/dir

For a complete overview of all parameters, run pleasant-cli with the --help switch:

> pleasant-cli --help
                       (--username | --password | --url | --custom-field [CUSTOM_FIELD] | --attachments [ATTACHMENTS [ATTACHMENTS ...]])
                       [--download-dir DOWNLOAD_DIR] [--api-url API_URL]
                       [--api-user API_USER] [--api-password API_PASSWORD]
                       [--disable-cert-check] [--verbose] [--debug]
                       path

positional arguments:
  path                  the path on the pleasant server to the credential
                        entry, e.g. /Development/git (env var:
                        PYPLEASANT_PATH_TO_ENTRY)

optional arguments:
  -h, --help            show this help message and exit
  --username            print the username
  --password            print the password
  --url                 print the URL
  --custom-field [CUSTOM_FIELD]
                        print the given custom field
  --attachments [ATTACHMENTS [ATTACHMENTS ...]]
                        download the given attachment(s); if no attachment is
                        given, all attachments are downloaded
  --download-dir DOWNLOAD_DIR
                        attachments are downloaded to this directory (DEFAULT:
                        '.', env var: PYPLEASANT_DOWNLOAD_DIR)
  --api-url API_URL     URL of the pleasant server api (env var:
                        PYPLEASANT_API_URL)
  --api-user API_USER   user for the pleasant server API (env var:
                        PYPLEASANT_API_USER)
  --api-password API_PASSWORD
                        password for the pleasant server API (env var:
                        PYPLEASANT_API_PASSWORD)
  --disable-cert-check  disable HTTPS cert check (env var:
                        PYPLEASANT_DISABLE_CERT_CHECK)
  --verbose             activate verbose output
  --debug               activate debug output (env var: PYPLEASANT_DEBUG)

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

pypleasant-1.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

pypleasant-1.0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pypleasant-1.0.1.tar.gz.

File metadata

  • Download URL: pypleasant-1.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.9

File hashes

Hashes for pypleasant-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7e7e3653da86b51765de6aa58afb72198826d3c0154176a398c1ede8721467d7
MD5 de18d8281d2257fcc64516204631b6b1
BLAKE2b-256 f0f5dc2576ef2468cdb3252c18377b5162ec0ba66b441415ca9959e3d8563654

See more details on using hashes here.

File details

Details for the file pypleasant-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pypleasant-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.9

File hashes

Hashes for pypleasant-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7df68f91b8f08c8f28fd14d1490394cc9742dd95df9989a731b331279c674a7b
MD5 fbc8f35a3f10cde80ca3512d80efda9e
BLAKE2b-256 726812f48d0dfff64d493a7107f3b989ed4feb84973b7f48c2aa20e6ee6fef77

See more details on using hashes here.

Supported by

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