summaryrefslogtreecommitdiff
path: root/sunshine
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-28 22:59:47 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-28 22:59:47 +0200
commit71b89c5fd966892151fbcd486164b85064aa8e98 (patch)
tree5070ffd194ae34481ea09fcf03436c5604406f65 /sunshine
parentaa1b5d6c9c425ddd885f98eb578c0cab6e4e5937 (diff)
Another fix. Maybe this time it will work.
Diffstat (limited to 'sunshine')
-rw-r--r--sunshine/lqsoft/gaduapi.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/sunshine/lqsoft/gaduapi.py b/sunshine/lqsoft/gaduapi.py
index 287665e..7cfa6eb 100644
--- a/sunshine/lqsoft/gaduapi.py
+++ b/sunshine/lqsoft/gaduapi.py
@@ -30,8 +30,8 @@ except ImportError:
proper_twisted = False
try:
- from OAuth import OAuthToken, OAuthRequest, OAuthConsumer, OAuthSignatureMethod_HMAC_SHA1
- test_oauth = OAuthSignatureMethod_HMAC_SHA1()
+ import oauth.oauth as oauth
+ test_oauth = oauth.OAuthSignatureMethod_HMAC_SHA1()
oauth_loaded = True
except:
logger.info("oAuth module can't be loaded")
@@ -101,9 +101,9 @@ class GG_Oauth(object):
self.agent = Agent(reactor)
- self.consumer = OAuthConsumer(self.uin, self.password)
+ self.consumer = oauth.OAuthConsumer(self.uin, self.password)
- self._signature_method = OAuthSignatureMethod_HMAC_SHA1()
+ self._signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1()
def getContentType(self, filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
@@ -142,7 +142,7 @@ class GG_Oauth(object):
url = str(PUT_AVATAR_URL % self.uin)
#print url
- oauth_request = OAuthRequest.from_consumer_and_token(self.consumer, token=self.access_token, http_method='PUT', http_url=url) # create an oauth request
+ oauth_request = oauth.OAuthRequest.from_consumer_and_token(self.consumer, token=self.access_token, http_method='PUT', http_url=url) # create an oauth request
oauth_request.sign_request(self._signature_method, self.consumer, self.access_token) # the request knows how to generate a signature
auth_header = oauth_request.to_header()
@@ -181,13 +181,13 @@ class GG_Oauth(object):
def accessTokenReceived(self, result, oauth_token):
print 'accessTokenReceived: ', result
content = json.loads(result)['result']
- oauth_access_token = OAuthToken(content['oauth_token'], content['oauth_token_secret'])
+ oauth_access_token = oauth.OAuthToken(content['oauth_token'], content['oauth_token_secret'])
#url = str(PUT_AVATAR_URL % content['uin'])
url = 'http://api.gadu-gadu.pl/users/5120225.xml'
print url
- oauth_request = OAuthRequest.from_consumer_and_token(self.consumer, token=oauth_access_token, http_method='GET', http_url=url) # create an oauth request
+ oauth_request = oauth.OAuthRequest.from_consumer_and_token(self.consumer, token=oauth_access_token, http_method='GET', http_url=url) # create an oauth request
oauth_request.sign_request(self._signature_method, self.consumer, oauth_access_token) # the request knows how to generate a signature
auth_header = oauth_request.to_header()
@@ -213,7 +213,7 @@ class GG_Oauth(object):
#print 'accessTokenReceived: ', result
content = json.loads(result)['result']
- self.access_token = OAuthToken(content['oauth_token'], content['oauth_token_secret'])
+ self.access_token = oauth.OAuthToken(content['oauth_token'], content['oauth_token_secret'])
self.expire_token = time.time()+36000
def requestAccessToken(self, response, oauth_token):
@@ -235,7 +235,7 @@ class GG_Oauth(object):
#print 'Response phrase:', result.phrase
#print 'Response headers:'
#print pformat(list(result.headers.getAllRawHeaders()))
- oauth_request = OAuthRequest.from_consumer_and_token(self.consumer, token=oauth_token, http_method='POST', http_url=ACCESS_TOKEN_URL) # create an oauth request
+ oauth_request = oauth.OAuthRequest.from_consumer_and_token(self.consumer, token=oauth_token, http_method='POST', http_url=ACCESS_TOKEN_URL) # create an oauth request
oauth_request.sign_request(self._signature_method, self.consumer, oauth_token) # the request knows how to generate a signature
auth_header = oauth_request.to_header()
@@ -271,7 +271,7 @@ class GG_Oauth(object):
def cbRequestTokenSuccess(self, result):
content = json.loads(result)['result']
- oauth_token = OAuthToken(content['oauth_token'], content['oauth_token_secret'])
+ oauth_token = oauth.OAuthToken(content['oauth_token'], content['oauth_token_secret'])
postvars = 'callback_url=http://www.mojageneracja.pl&request_token=%s&uin=%s&password=%s' % (oauth_token.key, self.uin, self.password)
@@ -299,7 +299,7 @@ class GG_Oauth(object):
#print 'cbShutdown: ', ignored
def requestToken(self):
- oauth_request = OAuthRequest.from_consumer_and_token(self.consumer, http_method='POST', http_url=REQUEST_TOKEN_URL) # create an oauth request
+ oauth_request = oauth.OAuthRequest.from_consumer_and_token(self.consumer, http_method='POST', http_url=REQUEST_TOKEN_URL) # create an oauth request
#oauth_request.set_parameter('oauth_timestamp', int(time.time())-3600)
oauth_request.sign_request(self._signature_method, self.consumer, None) # the request knows how to generate a signature
auth_header = oauth_request.to_header()