【发布时间】:2015-04-07 21:05:50
【问题描述】:
我正在尝试使用控制台中的参数来使用 --auth_local_webserver, --auth_host_port, 获取这些是必须的 来自 OAUTH2 的凭据,但我无法使其工作
我正在以这种方式使用控制台 python google\dev_appserver.py --auth_local_webserver=localhost --auth_host_port 项目/
我的目录是这个 项目/app.main 项目/处理程序/视频测试
而 VideoTesting 是我用来处理 gflags 的,我真的不太了解,我已经阅读了很多,
if FLAGS.auth_local_webserver:
success = False
port_number = 0
for port in FLAGS.auth_host_port:
port_number = port
debug.response.write(str(port_number))
try:
httpd = ClientRedirectServer((FLAGS.auth_host_name, port),
ClientRedirectHandler)
debug.response.write('what')
except socket.error, e:
pass
else:
success = True
break
FLAGS.auth_local_webserver = success
if FLAGS.auth_local_webserver:
oauth_callback = 'http://%s:%s/' % (FLAGS.auth_host_name, port_number)
else:
oauth_callback = 'oob'
authorize_url = flow.step1_get_authorize_url(oauth_callback)
FLAGS = gflags.FLAGS
gflags.DEFINE_boolean('auth_local_webserver', True,
('Run a local web server to handle redirects during '
'OAuth authorization.'))
gflags.DEFINE_string('auth_host_name', 'localhost',
('Host name to use when running a local web server to '
'handle redirects during OAuth authorization.'))
gflags.DEFINE_multi_int('auth_host_port', [8080, 8090],
('Port to use when running a local web server to '
'handle redirects during OAuth authorization.'))
【问题讨论】:
标签: python google-app-engine localhost gflags