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.1.tar.gz (24.1 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.1-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vaultio-0.1.1.tar.gz
  • Upload date:
  • Size: 24.1 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.1.tar.gz
Algorithm Hash digest
SHA256 6be1f81d9dbb5af8c8c933b48a9a8618b3b3b69adaedb5e09ec6171f04dec717
MD5 9f317c25805b3e72e9e55f48797f68ae
BLAKE2b-256 148c3c95e28d6426285f5fc263c555a9f3b831a6409258bd028b66d4bbf2e891

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vaultio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee20c129bf26b2b4877541cae6016523d2240f7ea448dc8baa03bb4d3afeb88a
MD5 36dc41ef764079528b6ee304edf3ad57
BLAKE2b-256 b797e8bbbb3732b46aeec2f7b1e698e9f20dc1bbcdb9b8320987be45bdedffc7

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