我正在尝试通过Python获取给定订阅的Recurly帐户电子邮件或给定帐户电子邮件的订阅状态。例如,当我尝试从帐户钻取到订阅时,

for account in r.Account.all():
    print 'Account: %s' % account
    print 'Sub: %s' % account.subscriptions


当我尝试访问account.subscription.state时出现错误:

AttributeError: 'function' object has no attribute 'state'


有人知道解决方案吗?

最佳答案

account有许多subscriptions,因此您需要遍历每个订阅并打印其状态。以下应适用于ya:

    for account in recurly.Account.all():
       print 'Account: %s' % account
       for subscription in account.subscriptions():
          print 'Subscription: %s' % subscription.state

关于python - 递归帐户订阅,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32348331/

10-13 06:42