2015-09-02 44 views
1

我正在尝试通过Python获得一个反向帐户电子邮件给定一个订阅或订阅状态给定一个帐户的电子邮件。当我尝试从帐户钻入认购例如,我得到一个反向帐户订阅

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' 

任何人都知道该如何解决?

回答

3

account有很多subscriptions,所以你需要迭代每个订阅并打印它的状态。以下应该适用于亚:

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

非常感谢! – Udi