aboutsummaryrefslogtreecommitdiffstats
path: root/mbsync/usr/bin/set-mail-password
blob: c36e39b8ba896d075cdfc6267478e8d08e13a7f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python3

import sys
from getpass import getpass
import secretstorage

connection = secretstorage.dbus_init()
collection = secretstorage.get_collection_by_alias(connection, "login")
attributes = {"application": "mbsync", "account": sys.argv[1]}

collection.create_item(
    "Password for '{}' on '{}'".format(
        attributes["account"], attributes["application"]
    ),
    attributes,
    getpass().encode(),
)