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.0.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.0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vaultio-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 7e37f6ad1cfd5ec81d73095c9590305d5f83f6359fca2703550fa52f07c5201b
MD5 1c8cd5f5b798eb2674f85662bc405642
BLAKE2b-256 a69c59bf3f0b2052765e464f00c85bfc64e75c9dd98adf17aba7b805ae8d80f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vaultio-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd76898dd4e783b2dcf1803daa60bd17725865e54fb14608c0c481fda1ebc41f
MD5 8b564109a66301596c9daab6c10fb927
BLAKE2b-256 4cd2d8eab50cdb44c02737c3f8bc4594bce09f8ecd963d17241abf49aa55f7f6

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