重新进行帐户订阅

时间:2015-09-02 08:36:06

标签: python recurly

我尝试通过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'

任何人都知道解决方案吗?

1 个答案:

答案 0 :(得分:3)

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

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