Python API

A python API that has about the same functionalities as the CLI client.

We use Ansible extensively to manage our infrastructure.
All our passwords, token, certificates and other sensitive data are stored in Bitwarden (we trust you ! <3), and right now we have developed an Ansible lookup plugin to easily fetch some data.

Drawbacks of the CLI :

  • Slow (1-3 seconds per call)
  • No handling of concurrent calls
  • A lot of bug prone / non-portable code to cache, handle the concurrency and call the CLI
  • No guarantee of the CLI interface stability
  • Needs nodejs and NPM installed where it is needed (we had to develop a specific AWX executor)

Why Python?

  • Can be used in a complex manner in a lot of other tools (Ansible being one of them)
  • Easy to develop
  • Easy to use
  • A lot of people know a bit about Python

For our specific use, we would at least need to be able to retrieve :

  • Username/passwords
  • Custom fields
  • Linked files

The Web API is not usable in this case because it doesn’t give access to those informations.

Have you tried using the REST api built into the CLI?