定期帐户订阅

Recurly Account Subscription

我正在尝试通过 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,因此您需要遍历每个订阅并打印其状态。以下应该适用于你:

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