def _request_refresh_token(self):
# create configuration file dir
config_dir = os.path.dirname(self._config_path)
if not os.path.isdir(config_dir):
os.makedirs(config_dir)
# open browser and ask for authorization
auth_request_url = gdal.GOA2GetAuthorizationURL(self._scope)
print('Authorize access to your Fusion Tables, and paste the resulting code below: ' + auth_request_url)
# webbrowser.open_new(auth_request_url)
auth_code = raw_input('Please enter authorization code: ').strip()
refresh_token = gdal.GOA2GetRefreshToken(auth_code, self._scope)
# save it
json.dump({'refresh_token': refresh_token}, open(self._config_path, 'w'))
return refresh_token
评论列表
文章目录