Legacy
...
Administration
Work with API

Python connector

8min
installation your python version should be 3 10 or higher pip install git+https //github com/passwork me/pip connector credentials the following credentials are required host — api server address, e g https // /api/v4 ; api key — your api key for authentication ( settings and users → api settings ); master password — client encryption key specify only if client encryption is enabled the login() method in an instance of the passworkapi class is used to get a temporary api token the received api token is stored as an instance variable named session options inside the passworkapi class and then sent in an http header this token is valid for the duration of the session, i e as long as requests to the api are made when the token expires, you need to log in again to generate a new one the validity period of the api token can be configured in passwork settings action examples creating a session (common step for all operations) create an instance of the api connection and open a session from passwork passwork api import passworkapi api = passworkapi( host="https // /api/v4", api key="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", master password="master password" ) password search search params = { "query" "test", "tags" \[], "colors" \[], "vaultid" none, "includeshared" false, "includeshortcuts" false, } from passwork password crud import search password found passwords = search password(api, search params) getting full password information download attachments path is not a required argument, without it attachments will be saved in the downloaded attachments/{password id} folder from passwork password crud import get inbox password inbox password id = "0123456789abcdefghijklmn" download attachments path = f"example folder/{inbox password id}" inbox password full info = get inbox password( api=api, inbox password id=inbox password id, download attachments path=download attachments path, log pretty data=false, ) adding a password if vault id is specified, the password id variable can be empty parameter description — add password https //github com/passwork me/pip connector/blob/main/passwork/password crud/add password py password adding fields = { } from passwork password crud import add password vault id = "0123456789abcdefghijklmn" added password info = add password( api=api, password adding fields=password adding fields, vault id=vault id, ) deleting a password from passwork password crud import delete password password id = "0123456789abcdefghijklmn" delete password(api=api, password id=password id)