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
- 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)
- 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
- Fill data in
search_paramsdict template with searching parameters tosearch_passwordmethod
search_params = {
"query": "test",
"tags": [],
"colors": [],
"vaultId": None,
"includeShared": False,
"includeShortcuts": False,
}
- 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.
- Specify
password_idand 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.
- 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.
- Fill data in
password_adding_fieldsdict template. Template is available in add_password function
password_adding_fields = {...}
- 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
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
755eedcb84564537741798dcecae860b2c6e9b4b167dc83820015f2f8b91ead6
|
|
| MD5 |
2a72955c1a0df3d4a6e2f8ab2c7ac95a
|
|
| BLAKE2b-256 |
db491e8c4c9cb0ea45e3a14b4295d2520b24e93726cce4f344863b9aba566a4d
|
File details
Details for the file passworkconnectortest-0.1.6-py3-none-any.whl.
File metadata
- Download URL: passworkconnectortest-0.1.6-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
989e48ab261a3ba25827685a613d19620f1463548f8bd680b96b7888e7e50eb7
|
|
| MD5 |
27f46baf1b69c9d3d935b917255b1a19
|
|
| BLAKE2b-256 |
73c72754032ec2a1cdf4938c4b5f9fcf1a140b3634ea7f38a4f5f9fb02a5d544
|