Skip to content

Commit eb9f755

Browse files
committed
use property
1 parent 63decde commit eb9f755

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

chinaapi/douban.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ def _parse_token(self, response):
3030
expires_in = data.get('expires_in', None)
3131

3232
token = Token(access_token, refresh_token=refresh_token, uid=uid)
33-
token.set_expires_in(expires_in)
33+
token.expires_in = expires_in
3434
return token

chinaapi/qq_weibo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _parse_token(self, response):
100100
refresh_token = data.get('refresh_token', None)
101101

102102
token = Token(access_token, refresh_token=refresh_token)
103-
token.set_expires_in(expires_in)
103+
token.expires_in = expires_in
104104
return token
105105

106106
def revoke(self, **kwargs):

chinaapi/renren.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _parse_token(self, response):
5454
expires_in = data.get('expires_in', None)
5555

5656
token = Token(access_token, refresh_token=refresh_token, uid=uid)
57-
token.set_expires_in(expires_in)
57+
token.expires_in = expires_in
5858
return token
5959

6060

chinaapi/sina_weibo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _parse_token(self, response):
6464
expires_in = data.get('expires_in', data.get('expire_in', None))
6565

6666
token = Token(access_token, created_at=created_at, uid=uid)
67-
token.set_expires_in(expires_in)
67+
token.expires_in = expires_in
6868
return token
6969

7070
def revoke(self, access_token):
@@ -97,7 +97,7 @@ def base64decode(s):
9797
sign = base64decode(encoded_sign)
9898
data = jsonDict.loads(base64decode(encoded_data))
9999
token = Token(data.oauth_token, created_at=data.issued_at, uid=data.user_id)
100-
token.set_expires_in(data.expires)
100+
token.expires_in = data.expires
101101
is_valid = data.algorithm == u'HMAC-SHA256' and hmac.new(self.app.key, encoded_data,
102102
hashlib.sha256).digest() == sign
103103
return token, is_valid

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_expired_access_token(self):
2424
def test_set_expires_in(self):
2525
expires_in = 60 * 60
2626
token = models.Token('token_string')
27-
token.set_expires_in(expires_in)
27+
token.expires_in = expires_in
2828
self.assertAlmostEqual(expires_in, token.expires_in, -1)
2929

3030

0 commit comments

Comments
 (0)