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:
@ -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)
|
||||
|
Reference in New Issue
Block a user