Skip to main content

Unofficial tool for stateless Bitwarden vault management

Project description

Python API for Bitwarden Vault Management

Overview

pybw is an unofficial Python API for managing Bitwarden vaults via the Bitwarden CLI. Instead of launching a new CLI process for each operation, it runs the CLI once in the background and communicates with it through a private socket connection. This improves performance and provides a secure method for using the serve API.

How It Works

The API is built around the stateful Express web server launched by the bw serve command. This server exposes a local REST API for performing vault actions. pybw wraps this API internally and delegates all actions to the Bitwarden CLI.

Note: pybw does not cache or store credentials. All requests are proxied directly to the background process.


Installation

🔧 Basic Setup

cd python
python -m venv .venv
source .venv/bin/activate
pip install poetry
poetry install

Installing the Bitwarden CLI

Option 1: Official CLI

By default, bw serve exposes its API via HTTP over TCP, which can be less secure since other users or apps might access the unlocked vault without proper firewall rules.

You can either:

  • Ensure bw is available in your PATH, or
  • Run:
pybw build

This installs the CLI from the official NPM package @bitwarden/cli.

Option 2: Unofficial Fork with Socket Support

A pull request introduces support for Unix sockets and other socket types in bw serve. This allows communication without traversing the network stack, improving security.

To enable this:

$HOME/.cache/pybw/bin/bw
  • Or, let pybw handle it for you:
pybw --unofficial

This will clone the repo and build it locally. (No pre-built binaries are currently provided.)


Usage

📘 API Documentation

See the full API reference.

📟 CLI Wrapper

pybw --help

🧪 Example: Check Status and List Items

from pybw.client import Client

with Client() as client:
    print(client.status())
    print(client.unlock())
    print(client.status())

    for item in client.list():
        print(item["name"])

    for folder in client.list(type="folder"):
        print(folder["name"])

🔍 More Examples


🔐 HTTPS Support

Not currently supported directly, but it's possible using Caddy.

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

vaultio-0.1.101.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

vaultio-0.1.101-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file vaultio-0.1.101.tar.gz.

File metadata

  • Download URL: vaultio-0.1.101.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.1 Linux/6.12.9-200.fc41.x86_64

File hashes

Hashes for vaultio-0.1.101.tar.gz
Algorithm Hash digest
SHA256 43a3c6ba7e62c971a69691c0a50b8af90beff072a3a99dfe469d8e8b351f82ac
MD5 d88bde37c45a84e99b62b0731a3955f8
BLAKE2b-256 3f42d32b35c4806f823d46df065f13450c885bfa0f7a980312fe9ede87aed2b8

See more details on using hashes here.

File details

Details for the file vaultio-0.1.101-py3-none-any.whl.

File metadata

  • Download URL: vaultio-0.1.101-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.1 Linux/6.12.9-200.fc41.x86_64

File hashes

Hashes for vaultio-0.1.101-py3-none-any.whl
Algorithm Hash digest
SHA256 f53c45d83cf34aeeb4022c203951067d4114bce2023785672c4b11a9e53ba1d9
MD5 9d09b6bbbe3482007ec8783d431955b3
BLAKE2b-256 1cd69f71b54aa8d707d399e6e7c096e837683e8f6d532b3e322eb86b3ffef4ba

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