Skip to main content

Passwork API connector

Project description

About the API

Passwork API lets you retrieve, create, update passwords, folders and vaults. It is an easy way how you can integrate Passwork with your infrastructure. Use our Passwork Python Connector to make the integration smoother. The API operates behalf of the user whom API Key is used. Check for all available methods in Passwork API Methods

How to install

⚠️WARNING the connector will not work with python version less than 3.10

pip install passworkconnector

Credentials

The following credentials are required for operation:

host: The address of the API server, like https://.../api/v4
api_key: Your API key for authentication, instructions for obtaining below
master_password: Client-side encryption key. Only add it when client-side encryption is enabled

API Key

alt text

  • Sign in to your Passwork
  • Menu → API Settings
  • Enter your authorization key and generate the API Key

Method login() on instance of PassworkAPI class is used to retrieve a temporary API Token. An API token is a session token. It is valid as long as you are accessing the API. After it expires, you will need to log in again. API Token Lifetime can be set up in your Passwork. The retrieved API token is stored as an instance variable named session_options within the PassworkAPI class and is subsequently sent in an HTTP header.

Step-by-step guide

Create session (common step for all operations)

  1. Create instance of API connection and open session.
from passwork.passwork_api import PassworkAPI

api = PassworkAPI(
    host="https://.../api/v4",
    api_key="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    master_password="master_password"
)

Password search by parameters

  1. Fill data in search_params dict template with searching parameters to search_password method
search_params = {
    "query": "test",
    "tags": [],
    "colors": [],
    "vaultId": None,
    "includeShared": False,
    "includeShortcuts": False,
}
  1. Search password
from passwork.password_crud import search_password
found_passwords = search_password(api, search_params)

Get full password info

NOTE password_id must contain the identifier of the target password, in the example a non-existent identifier is specified.
NOTE download_attachments_path is not a required argument, without specifying it, attachments will be saved to downloaded_attachments/{password_id} folder.

  1. Specify password_id and get full password info
from passwork.password_crud import get_password

password_id = "0123456789abcdefghijklmn"
download_attachments_path = f"example_folder/{password_id}"

password_full_info = get_password(
    api=api,
    password_id=password_id,
    download_attachments_path=download_attachments_path,
    log_pretty_data=False,
)

Get inbox password info

NOTE Without explicitly specifying password_id the information for the last password in Inbox will be logged.
NOTE download_attachments_path is not a required argument, without specifying it, attachments will be saved to downloaded_inbox_attachments/{password_id} folder.

  1. Get full inbox password info
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,
)

Add password

NOTE If vault_id is specified, the password_id variable may be empty. Without specifying of vault_id, the identifier of the vault where the password with id = password_id is stored will be taken. The identifiers password_id and vault_id in the example are non-existent.

  1. Fill data in password_adding_fields dict template. Template is available in add_password function
password_adding_fields = {...}
  1. Add password
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,
    )

Delete password

NOTE password_id must contain the identifier of the target password, in the example a non-existent identifier is specified

  1. Delete a password by its id
from passwork.password_crud import delete_password

password_id = "0123456789abcdefghijklmn"

delete_password(api=api, password_id=password_id)

License

This project is licensed under the terms of the MIT license.

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

passworkconnectortest-0.1.6.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

passworkconnectortest-0.1.6-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file passworkconnectortest-0.1.6.tar.gz.

File metadata

  • Download URL: passworkconnectortest-0.1.6.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.7

File hashes

Hashes for passworkconnectortest-0.1.6.tar.gz
Algorithm Hash digest
SHA256 755eedcb84564537741798dcecae860b2c6e9b4b167dc83820015f2f8b91ead6
MD5 2a72955c1a0df3d4a6e2f8ab2c7ac95a
BLAKE2b-256 db491e8c4c9cb0ea45e3a14b4295d2520b24e93726cce4f344863b9aba566a4d

See more details on using hashes here.

File details

Details for the file passworkconnectortest-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for passworkconnectortest-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 989e48ab261a3ba25827685a613d19620f1463548f8bd680b96b7888e7e50eb7
MD5 27f46baf1b69c9d3d935b917255b1a19
BLAKE2b-256 73c72754032ec2a1cdf4938c4b5f9fcf1a140b3634ea7f38a4f5f9fb02a5d544

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