可以从http:// localhost:8100 / remote_api加载数据(谷歌应用引擎)

时间:2010-06-18 08:29:48

标签: python google-app-engine download localhost

我可以从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 个答案:

答案 0 :(得分:2)

默认端口为8080,而非8100。使用8100会出现Authentication Failed错误。

此外,如果你的app.yaml确实使用了以下方式启用了远程api:

builtins:
- remote_api: on

然后你需要使用以下网址:

http://localhost:8080/_ah/remote_api

而不是:

http://localhost:8080/remote_api

此外,您需要指定一种(对于开发服务器),例如:

--kind=MyDataClass

答案 1 :(得分:1)

您可能需要使用--kind=LogText作为LogText类型,然后对其他各种类型重复,因为开发Web服务器不支持下载所有类型 - 它一次只能执行一次。

不确定这是否会导致404。

答案 2 :(得分: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>