dotfiles/mbsync/usr/bin/set-mail-password

18 lines
426 B
Text
Raw Normal View History

2019-07-22 17:37:35 +02:00
#!/usr/bin/python3
2016-08-05 01:43:09 +02:00
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]}
2016-08-05 01:43:09 +02:00
collection.create_item(
"Password for '{}' on '{}'".format(
attributes["account"], attributes["application"]
),
attributes,
getpass().encode(),
)