#!/usr/bin/env python

import keyring
import sys

def ask_keystore(service, user):

    return keyring.get_password(service, user)

if (len(sys.argv) == 3):
    pw = ask_keystore(sys.argv[1], sys.argv[2])
    if (pw == None):
        sys.stderr.write("no password found\n")
        sys.exit(1)
    else:
        print pw
else:
    sys.stderr.write("get_pwd SERVICE USER\n")
    sys.exit(1)
