Made some changes to the api threads and related callback so that we can save the members in each list into a data structure. This will help when building out some more List API functionality

This commit is contained in:
Anna
2010-06-02 13:53:03 -04:00
parent 5a675ee8d9
commit 48cce6a353
2 changed files with 18 additions and 9 deletions

View File

@ -36,11 +36,7 @@ class CustomApi(OAuthApi):
def on_lists_ready(self, widget, lists, ignored):
list_names = []
for l in lists['lists']:
list_names.append(l.name)
list_names.sort()
self.sig_proxy.emit('lists-ready', self.username, list_names)
self.sig_proxy.emit('lists-ready', self.username, lists)
# End class CustomApi
@ -260,14 +256,17 @@ class GetUserLists(ApiThread):
def run(self):
lists = []
lists = {}
done = False
while not done:
done = True
try:
with self.api.lock:
lists = self.api.GetUserLists()
twitter_lists = self.api.GetUserLists()
for name in [l.name for l in twitter_lists['lists']]:
list_members = self.api.GetListMembers(name)
lists[name] = [u.name for u in list_members['users']]
except (HTTPError, URLError) as exception:
print 'debug: GetUserLists had error: ' + str(exception.code)
sleep(30)