在本地开发环境中,upload_data命令不会启动OAuth浏览器。那是为什么?!?
代码在App Engine上运行得很好,但在本地开发环境中却不行。是否有针对开发环境使用远程API的技巧。
以下是我如何使用命令...
appcfg.py upload_data --config_file=bulkloader.yaml --filename=./stops.txt --kind=StopLocationLoader --url=http://localhost:8082/_ah/remote_api
10:39 PM Uploading data records.
[INFO ] Logging to bulkloader-log-20161017.223916
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
Error 401: --- begin server output ---
You must be logged in as an administrator to access this.
--- end server output ---
答案 0 :(得分:1)
这是一个错误:https://code.google.com/p/googleappengine/issues/detail?id=12445
它链接到为another question发布的变通方法:
gcloud auth login
gcloud auth print-access-token
appcfg.py upload_data --oauth2_access_token=<oauth2_access_token> --config_file bulkloader.yaml --url=http://<yourproject>.appspot.com/remote_api --filename places.csv --kind=Place --email=<you@gmail.com>