def get_info(self): param = {'access_token': self._access_token} res = json.load( StringIO( util.safe_call(_get_token_info_url, payload=urlencode(param), method=urlfetch.POST).content)) return res
def has_expired(self): try: param = {'access_token': self._access_token} res = json.load(StringIO(util.safe_call(_get_token_info_url, payload = urlencode(param), method = urlfetch.POST).content)) if 'error_code' in res: if res['error_code'] in [21315,21327]: return True else: return False except: return False
def get_access_token(self, code): param = { 'client_id': _app_key, 'client_secret': _app_secret, 'grant_type': 'authorization_code', 'code': code, 'redirect_uri': _redirect_uri } s = json.load( StringIO( util.safe_call(url=_access_token_url, payload=urlencode(param), method=urlfetch.POST).content)) return s['access_token']
def has_expired(self): try: param = {'access_token': self._access_token} res = json.load( StringIO( util.safe_call(_get_token_info_url, payload=urlencode(param), method=urlfetch.POST).content)) if 'error_code' in res: if res['error_code'] in [21315, 21327]: return True else: return False except: return False
def post(_url, _data): r = StringIO(util.safe_call(_url, payload = _data, method=urlfetch.POST).content) return r
def get(_url): r = StringIO(util.safe_call(_url).content) return r
def get_info(self): param = {'access_token': self._access_token} res = json.load(StringIO(util.safe_call(_get_token_info_url, payload = urlencode(param), method = urlfetch.POST).content)) return res
def get_access_token(self, code): param = {'client_id': _app_key, 'client_secret': _app_secret, 'grant_type': 'authorization_code', 'code': code, 'redirect_uri': _redirect_uri} s = json.load(StringIO(util.safe_call(url=_access_token_url, payload = urlencode(param), method=urlfetch.POST).content)) return s['access_token']
def post(_url, _data): r = StringIO( util.safe_call(_url, payload=_data, method=urlfetch.POST).content) return r