nixos/config/emacs-old/.offlineimap.py

53 lines
1.1 KiB
Python
Raw Normal View History

2024-09-23 11:50:35 +04:00
#! /usr/bin/env python
from subprocess import check_output
import re
def get_pass(account):
return check_output("pass " + account, shell=True).splitlines()[0]
def get_user(account):
usercmd = check_output("pass " + account, shell=True)
return re.search(rb"login: (.*)", usercmd, flags=0).group(1).decode("utf-8")
2024-09-23 11:50:35 +04:00
2024-10-09 19:27:32 +04:00
def get_host(account):
usercmd = check_output("pass " + account, shell=True)
return re.search(rb"host: (.*)", usercmd, flags=0).group(1).decode("utf-8")
2024-09-23 11:50:35 +04:00
def hydroxide(path):
file = open(path, "r")
pword = file.read()
return pword
2024-09-24 09:45:15 +04:00
def get_client_id(account):
cmd = check_output("pass " + account, shell=True)
2024-09-23 11:50:35 +04:00
output = re.search("client_id: (.*)", cmd.decode(), flags=0).group(1)
return output
2024-09-23 11:50:35 +04:00
2024-09-24 09:45:15 +04:00
def get_client_secret(account):
cmd = check_output("pass " + account, shell=True)
2024-09-23 11:50:35 +04:00
output = re.search("client_secret: (.*)", cmd.decode(), flags=0).group(1)
return output
2024-09-23 11:50:35 +04:00
2024-09-24 10:04:40 +04:00
def get_client_refresh_token(account):
2024-09-24 10:02:45 +04:00
cmd = check_output("pass " + account, shell=True)
output = re.search("client_refresh_token: (.*)", cmd.decode(), flags=0).group(1)
2024-09-24 10:20:07 +04:00
return output