1

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

有人知道解决方案吗?

4

1 回答 1

3

Anaccount有很多subscriptions,因此您需要遍历每个订阅并打印其状态。以下应该对你有用:

    for account in recurly.Account.all():
       print 'Account: %s' % account
       for subscription in account.subscriptions():
          print 'Subscription: %s' % subscription.state
于 2015-09-02T19:20:44.857 回答