From 9e0e431d4c7308cc447abb5a934704451da4949e Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 20 May 2010 20:51:20 -0400 Subject: [PATCH] Fixed some problems with oauthtwitter --- hrafn.py | 8 +++----- oauthtwitter.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hrafn.py b/hrafn.py index 722ec7a..71ce623 100755 --- a/hrafn.py +++ b/hrafn.py @@ -56,7 +56,7 @@ class Hrafn(): self.db = shelve.open(db_file) if not self.db.has_key('tokens'): - self.db['tokens'] = {} + self.db['tokens'] = [] if not self.db.has_key('active_page'): self.db['active_page'] = 0 @@ -540,9 +540,7 @@ class Hrafn(): if token is None: return - api = apithreads.CustomApi(token) - username = api.username - + # fixme: need this to work, but need username AFTER we create the API... if not self.accounts.has_key(username): tokens = self.db['tokens'] tokens.append(token) @@ -551,7 +549,7 @@ class Hrafn(): def add_account(self, token): - api = CustomApi(token) + api = apithreads.CustomApi(token) username = api.username self.accounts[username] = api self.accounts[username].sig_proxy.connect('lists-ready', self.on_lists_ready) diff --git a/oauthtwitter.py b/oauthtwitter.py index 3e7bfd4..d36d003 100755 --- a/oauthtwitter.py +++ b/oauthtwitter.py @@ -14,7 +14,7 @@ __author__ = "Hameedullah Khan " __version__ = "0.2" -from twitter import Api +from twitter import Api,NewUserFromJsonDict from twitter_pb2 import User import simplejson @@ -207,5 +207,5 @@ class OAuthApi(Api): json = self._FetchUrl(url) data = simplejson.loads(json) self._CheckForTwitterError(data) - return User.NewFromJsonDict(data) + return NewUserFromJsonDict(data)