本文整理汇总了Python中backend.Backend.get_accounts方法的典型用法代码示例。如果您正苦于以下问题:Python Backend.get_accounts方法的具体用法?Python Backend.get_accounts怎么用?Python Backend.get_accounts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backend.Backend
的用法示例。
在下文中一共展示了Backend.get_accounts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from backend import Backend [as 别名]
# 或者: from backend.Backend import get_accounts [as 别名]
def main():
import argparse
parser = argparse.ArgumentParser(description='set password for AppleID. CAUTION: Use AppleIDs with payment credentials at you own risk!!! EVERY purchase will be done if possible!!! The password will be stored UNENCRYPTED!!!')
parser.add_argument('-b','--backend', required=True, help='the backend url')
parser.add_argument('-a','--appleId', required=True, help='the AppleId')
parser.add_argument('-p','--password', required=True, help='the password')
args = parser.parse_args()
logger.debug(args)
backend = Backend(args.backend)
accounts = backend.get_accounts()
passwordUpdated = False
for accId, acc in accounts.items():
if 'appleId' in acc and acc['appleId'] == args.appleId:
logger.debug(str(acc))
acc['password'] = args.password
passwordUpdated = backend.post_account(acc)
break
if passwordUpdated:
print "password updated for AppleId '%s'" % args.appleId
else:
print "unable to update password for AppleId '%s'" % args.appleId