Accounts (and others) not iterable #14
Closed
newoldtrader
started this conversation in
General
Replies: 1 comment 8 replies
-
Thanks for reporting this @newoldtrader. I agree we can improve the containers like
|
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm new to python, so there may be a simple solution to this.
After installing and trying out the example code, I attempted to sort the returned accounts_page.accounts using
accounts_page.accounts.sort(key=lambda x: x['name'])
I kept getting:
TypeError: 'Account' object is not subscriptable
I found that by adding
def __getitem__(self, item): return getattr(self, item)
in the Account class allows the sort to work.
Beta Was this translation helpful? Give feedback.
All reactions