def request_access_token_info(self, access_token): """ 该接口传入参数access_token为已经授权的access_token,函数将返回该access_token的详细信息,返回Json对象,与APIClient类的request_access_token类似。 """ r = weibo._http_post('%s%s' % (self.auth_url, 'get_token_info'), access_token = access_token) # TODO 此处时间rtime,expires比较用处是何? current = int(time.time()) expires = r.expire_in + current remind_in = r.get('remind_in', None) if remind_in: rtime = int(remind_in) + current if rtime < expires: expires = rtime return weibo.JsonDict(expires=expires, expires_in=expires, uid=r.get('uid', None))
def request_access_token_info(self, at): ''' return access token as a JsonDict: {"access_token":"your-access-token","expires_in":12345678,"uid":1234}, expires_in is represented using standard unix-epoch-time ''' r = weibo._http_post('%s%s' % (self.auth_url, 'get_token_info'), access_token=at) current = int(time.time()) expires = r.expire_in + current remind_in = r.get('remind_in', None) if remind_in: rtime = int(remind_in) + current if rtime < expires: expires = rtime return weibo.JsonDict(expires=expires, expires_in=expires, uid=r.get('uid', None))
def request_access_token_info(self, at): """ 该接口传入参数at为已经授权的access_token,函数将返回该access_token的详细信息,返回Json对象,与APIClient类的request_access_token类似。 """ print '进入到了request_access_token_info函数' r = weibo._http_post('%s%s' % (self.auth_url, 'get_token_info'), access_token=at) current = int(time.time()) expires = r.expire_in + current remind_in = r.get('remind_in', None) print '哈哈哈哈哈 %s' % (remind_in) if remind_in: rtime = int(remind_in) + current if rtime < expires: expires = rtime return weibo.JsonDict(expires=expires, expires_in=expires, uid=r.get('uid', None))
def request_access_token_info(self, access_token): r = weibo._http_post('%s%s' % (self.auth_url, 'get_token_info'), access_token=access_token) current = int(time.time()) expires = r.expire_in + current return weibo.JsonDict(expires_in=expires)