能从http://localhost:8100/remote_api加载数据(Google App 引擎)吗
我可以从GAE下载数据(http://zjm1126.appspot.com/remote_api),这是我的代码:
appcfg.py download_data --application=zjm1126 --url=http://zjm1126.appspot.com/remote_api --filename=a.csv
而且它成功了:
D:\zjm_demo\app>appcfg.py download_data --application=zjm1126 --url=http://zjm1
126.appspot.com/remote_api --filename=a.csv
Downloading data records.
[INFO ] Logging to bulkloader-log-20100618.162421
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
[INFO ] Opening database: bulkloader-progress-20100618.162421.sql3
[INFO ] Opening database: bulkloader-results-20100618.162421.sql3
[INFO ] Connecting to zjm1126.appspot.com/remote_api
Please enter login credentials for zjm1126.appspot.com
Email: zjm1126@gmail.com
Password for zjm1126@gmail.com:
[INFO ] Downloading kinds: [u'LogText', u'Greeting', u'Forum', u'Thread']
....
[INFO ] Have 0 entities, 0 previously transferred
[INFO ] 0 entities (8804 bytes) transferred in 11.3 seconds
所以我想知道能不能从127.0.0.1加载数据,这是我的代码:
appcfg.py download_data --application=zjm1126 --url=http://localhost:8100/remote_api --filename=a.csv
但是出现了错误:
D:\zjm_demo\app>appcfg.py download_data --application=zjm1126 --url=http://loca
lhost:8100/remote_api --filename=a.csv
Downloading data records.
[INFO ] Logging to bulkloader-log-20100618.162325
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
[INFO ] Opening database: bulkloader-progress-20100618.162325.sql3
[INFO ] Opening database: bulkloader-results-20100618.162325.sql3
Please enter login credentials for localhost
Email: zjm1126@gmail.com
Password for zjm1126@gmail.com:
[INFO ] Connecting to localhost:8100/remote_api
[ERROR ] Exception during authentication
Traceback (most recent call last):
File "d:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 3169, in Run
self.request_manager.Authenticate()
File "d:\Program Files\Google\google_appengine\google\appengine\tools\bulkload
er.py", line 1178, in Authenticate
remote_api_stub.MaybeInvokeAuthentication()
File "d:\Program Files\Google\google_appengine\google\appengine\ext\remote_api
\remote_api_stub.py", line 542, in MaybeInvokeAuthentication
datastore_stub._server.Send(datastore_stub._path, payload=None)
File "d:\Program Files\Google\google_appengine\google\appengine\tools\appengin
e_rpc.py", line 346, in Send
f = self.opener.open(req)
File "D:\Python25\lib\urllib2.py", line 387, in open
response = meth(req, response)
File "D:\Python25\lib\urllib2.py", line 498, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python25\lib\urllib2.py", line 425, in error
return self._call_chain(*args)
File "D:\Python25\lib\urllib2.py", line 360, in _call_chain
result = func(*args)
File "D:\Python25\lib\urllib2.py", line 506, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
[INFO ] Authentication Failed
那我该怎么办呢,
谢谢
3 个回答
1
与其使用
appcfg.py download_data --application=zjm1126 --url=http://localhost:8100/remote_api --filename=a.csv
不如试试使用
appcfg.py download_data --filename=a.csv <folder containing your app.yaml>
1
你可能需要使用 --kind=LogText
来指定你的日志类型,然后对其他类型重复这个操作,因为开发用的网络服务器不支持一次下载所有类型的文件,它只能一次下载一个。
不过,我不确定这样做是否会导致404错误。
2
默认的端口是 8080
,而不是 8100
。如果你使用 8100
,会出现 Authentication Failed
的错误。
另外,如果你的 app.yaml 文件中启用了远程 API,使用的是:
builtins:
- remote_api: on
那么你需要使用以下的 URL:
http://localhost:8080/_ah/remote_api
而不是:
http://localhost:8080/remote_api
此外,你还需要指定一个类型(对于开发服务器),比如:
--kind=MyDataClass