Python library for interacting with PrivateBin's v2 API (PrivateBin >= 1.3) to create, retrieve, and delete encrypted pastes.
privatebin is available on PyPI, so you can
simply use pip to install it.
pip install privatebinCheckout the quick start page and the API reference.
This is a pure-Python project, so development is pretty straightforward.
I use uv to manage the project.
Linting, formatting, and type checking are handled by Ruff and Pyrefly:
uv run ruff check
uv run ruff format
uv run pyrefly check
The testing story is a bit more interesting because the test suite runs entirely offline.
Simply invoking pytest will run all the unit tests:
uv run pytest
Tacking on --integration to that will run the integration tests, which reside in
tests\integration, against a real instance of PrivateBin. This instance will be
created automatically as long as you have Docker or Podman available (it will fail
otherwise) via ./docker/compose.yaml, and is cleaned up afterwards.
By default, it uses port 59483, but you can pass a different one:
uv run pytest --integration --port 54748
I also support passing any HTTP client that satisfies the
HttpClientProtocol,
but the integration tests only run against the default HTTP client by default.
You'll have to pass --all-http-clients to run the integration tests against
several other HTTP clients that I test for protocol compatibility with:
uv run pytest --integration --all-http-clients
Note that the specific HTTP clients are not documented because the goal is to support the interface rather than any particular implementation.
Distributed under the MIT License. See LICENSE for more information.