我应该在开发服务器上为 Google App Engine BulkLoader 输入哪些凭据?

2024-04-14

我想问一下,使用 Google App Engine BulkLoader 类导入数据时需要提供哪种凭据

appcfg.py upload_data --config_file=models.py --filename=listcountries.csv --kind=CMSCountry --url=http://localhost:8178/remote_api vit/

然后它要求我提供凭据:

请输入登录凭据 本地主机

这里是models.py内容的提取,我用的是这个列表国家.csv http://www.andrewpatton.com/countrylist.html file

class CMSCountry(db.Model):
  sortorder = db.StringProperty()
  name = db.StringProperty(required=True)
  formalname = db.StringProperty()
  type = db.StringProperty()
  subtype = db.StringProperty()
  sovereignt = db.StringProperty()
  capital = db.StringProperty()
  currencycode = db.StringProperty()
  currencyname = db.StringProperty()
  telephonecode = db.StringProperty()
  lettercode = db.StringProperty()
  lettercode2 = db.StringProperty()
  number = db.StringProperty()
  countrycode = db.StringProperty()

class CMSCountryLoader(bulkloader.Loader):
  def __init__(self):
    bulkloader.Loader.__init__(self, 'CMSCountry',
                           [('sortorder', str),
                            ('name', str),
                            ('formalname', str),
                            ('type', str),
                            ('subtype', str),
                            ('sovereignt', str),
                            ('capital', str),
                            ('currencycode', str),
                            ('currencyname', str),
                            ('telephonecode', str),
                            ('lettercode', str),
                            ('lettercode2', str),
                            ('number', str),
                            ('countrycode', str)
                            ])
loaders = [CMSCountryLoader] 

每次尝试输入电子邮件和密码都会导致“身份验证失败”,因此我无法将数据导入到开发服务器。

我认为我的文件和模型都没有任何问题,因为我已成功将数据上传到 appspot.com 应用程序。
那么我应该为本地主机凭据输入什么?
我也尝试使用Eclipse 与 Pydev但我仍然收到同样的消息:(
这是输出:

Uploading data records.
[INFO    ] Logging to bulkloader-log-20090820.121659
[INFO    ] Opening database: bulkloader-progress-20090820.121659.sql3
[INFO    ] [Thread-1] WorkerThread: started
[INFO    ] [Thread-2] WorkerThread: started
[INFO    ] [Thread-3] WorkerThread: started
[INFO    ] [Thread-4] WorkerThread: started
[INFO    ] [Thread-5] WorkerThread: started
[INFO    ] [Thread-6] WorkerThread: started
[INFO    ] [Thread-7] WorkerThread: started
[INFO    ] [Thread-8] WorkerThread: started
[INFO    ] [Thread-9] WorkerThread: started
[INFO    ] [Thread-10] WorkerThread: started
Password for [email protected] /cdn-cgi/l/email-protection: [DEBUG   ] Configuring remote_api. url_path = /remote_api, servername = localhost:8178

[DEBUG   ] Bulkloader using app_id: abc
[INFO    ] Connecting to /remote_api
[ERROR   ] Exception during authentication
Traceback (most recent call last):
  File "D:\Projects\GoogleAppEngine\google_appengine\google\appengine\tools\bulkloader.py", line 2802, in Run
request_manager.Authenticate()
  File "D:\Projects\GoogleAppEngine\google_appengine\google\appengine\tools\bulkloader.py", line 1126, in Authenticate
remote_api_stub.MaybeInvokeAuthentication()
  File "D:\Projects\GoogleAppEngine\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 488, in MaybeInvokeAuthentication
datastore_stub._server.Send(datastore_stub._path, payload=None)
  File "D:\Projects\GoogleAppEngine\google_appengine\google\appengine\tools\appengine_rpc.py", line 344, in Send
f = self.opener.open(req)
  File "C:\Python25\lib\urllib2.py", line 381, in open
response = self._open(req, data)
  File "C:\Python25\lib\urllib2.py", line 399, in _open
'_open', req)
  File "C:\Python25\lib\urllib2.py", line 360, in _call_chain
result = func(*args)
  File "C:\Python25\lib\urllib2.py", line 1107, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python25\lib\urllib2.py", line 1082, in do_open
raise URLError(err)
URLError: <urlopen error (10061, 'Connection refused')>
[INFO    ] Authentication Failed

谢谢你!


EUREKA:我找到了使用方法bulkloader.py工具,无需手动输入登录凭据。

以下是 2 个步骤:


设置你的app.yaml归档。例子:

- url: /remote_api
  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
  login: admin

你应该把它放在你的之前- url: .*线路输入app.yaml,否则你将永远无法访问/remote_api url.

请注意,我已经离开了login: admin部分,因为删除它是一种非常糟糕的做法,因为您可能会将其部署到生产中......


2 启动此命令(根据您的需要进行调整)。

echo 'XX' | python2.5 ../google_appengine/bulkloader.py --dump --kind=NAMEOFMODEL --url=http://localhost:8080/remote_api --filename=FILENAME --app_id=APPID [email protected] /cdn-cgi/l/email-protection --passin .

诀窍是使用这两个参数的组合:

  • --email=(你可以输入你想要的电子邮件地址,我用[email protected] /cdn-cgi/l/email-protection)
  • --passin

指定--email=将抑制“输入凭据”提示,并且--passin将允许读取密码stdin(这就是echo 'XX' |开始发挥作用!)


Enjoy!

P.S.:不要忘记投票,以便 Google 可以提供一种更易于使用的方式来做到这一点:第2440期 http://code.google.com/p/googleappengine/issues/detail?id=2440.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我应该在开发服务器上为 Google App Engine BulkLoader 输入哪些凭据? 的相关文章

  • Twisted 的 Deferred 和 JavaScript 中的 Promise 一样吗?

    我开始在一个需要异步编程的项目中使用 Twisted 并且文档非常好 所以我的问题是 Twisted 中的 Deferred 与 Javascript 中的 Promise 相同吗 如果不是 有什么区别 你的问题的答案是Yes and No
  • 如何在Python中流式传输和操作大数据文件

    我有一个相对较大 1 GB 的文本文件 我想通过跨类别求和来减小其大小 Geography AgeGroup Gender Race Count County1 1 M 1 12 County1 2 M 1 3 County1 2 M 2
  • 如何以“正确”的方式处理带有空字节的 Python unicode 字符串?

    Question PyWin32 似乎很乐意将 null 终止的 unicode 字符串作为返回值 我想以 正确 的方式处理这些字符串 假设我得到一个像这样的字符串 u C Users Guest MyFile asy x00 x00sy
  • 使用 python 中的公式函数使从 Excel 中提取的值的百分比相等

    import xlrd numpy excel Users Bob Desktop wb1 xlrd open workbook excel assignment3 xlsx sh1 wb1 sheet by index 0 colA co
  • Pandas:GroupBy 到 DataFrame

    参考这个关于 groupby 到 dataframe 的非常流行的问题 https stackoverflow com questions 10373660 converting a pandas groupby object to dat
  • 如何在Python中同时运行两只乌龟?

    我试图让两只乌龟一起移动 而不是一只接着另一只移动 例如 a turtle Turtle b turtle Turtle a forward 100 b forward 100 但这只能让他们一前一后地移动 有没有办法让它们同时移动 有没有
  • 如果未引发异常,则通过 Python 单元测试

    在Python中unittest框架 是否有一种方法可以在未引发异常的情况下通过单元测试 否则会因 AssertRaise 而失败 如果我正确理解你的问题 你could做这样的事情 def test does not raise on va
  • 一段时间后终止线程的最 Pythonic 方法

    我想在线程中运行一个进程 它正在迭代一个大型数据库表 当线程运行时 我只想让程序等待 如果该线程花费的时间超过 30 秒 我想终止该线程并执行其他操作 通过终止线程 我的意思是我希望它停止活动并优雅地释放资源 我认为最好的方法是通过Thre
  • 在 matplotlib 中的极坐标图上移动径向刻度标签

    From matplotlib 示例 http matplotlib org examples pylab examples polar demo html import numpy as np import seaborn as sbs
  • Django send_mail SMTPSenderRefused 530 与 gmail

    一段时间以来 我一直在尝试使用 Django 从我正在开发的网站接收电子邮件 现在 我还没有部署它 并且我正在使用Django开发服务器 我不知道这是否会影响它 这是我的 settings py 配置 EMAIL BACKEND djang
  • 在 Windows 上使用 apache mod_wsgi 运行 Flask 应用程序时导入冲突

    我允许您询问我在 Windows 上使用您的 mod wsgi portage 托管 Flask 应用程序时遇到的问题 我有两个烧瓶应用程序 由于导入冲突 只有一个可以同时存在 IE 如果请求申请 1 我有回复 然后 如果我请求应用程序 2
  • 使用Python计算目录的大小?

    在我重新发明这个特殊的轮子之前 有没有人有一个很好的例程来使用 Python 计算目录的大小 如果例程能够很好地以 Mb Gb 等格式格式化大小 那就太好了 这会遍历所有子目录 总结文件大小 import os def get size s
  • 从Android客户端登录appengine

    我正在尝试登录应用程序引擎并访问应用程序引擎中的用户服务API 基本上我希望能够看到谁登录了我的 servlet 我正在使用从 android 获取 authtoken 然后从应用程序引擎获取 ASID 或 SACID cookie 的身份
  • ANTLR 获取并拆分词法分析器内容

    首先 对我的英语感到抱歉 我还在学习 我为我的框架编写 Python 模块 用于解析 CSS 文件 我尝试了 regex ply python 词法分析器和解析器 但我发现自己在 ANTLR 中 第一次尝试 我需要解析 CSS 文件中的注释
  • Mac OSX 10.6 上的 Python mysqldb 不工作

    我正在使用 Python 2 7 并尝试让 Django 项目在 MySQL 后端运行 我已经下载了 mysqldb 并按照此处的指南进行操作 http cd34 com blog programming python mysql pyth
  • Anaconda 无法导入 ssl 但 Python 可以

    Anaconda 3 Jupyter笔记本无法导入ssl 但使用Atom终端导入ssl没有问题 我尝试在 Jupyter 笔记本中导入 ssl 但出现以下错误 C ProgramData Anaconda3 lib ssl py in
  • 在系统托盘中隐藏 tkinter 窗口 [重复]

    这个问题在这里已经有答案了 我正在制作一个程序来提醒我朋友的生日 这样我就不会忘记祝福他们 为此 我制作了两个 tkinter 窗口 1 First one is for entering name and birth date 2 Sec
  • 双击打开 ipython 笔记本

    相关文章 通过双击 osx 打开 ipython 笔记本 https stackoverflow com questions 16158893 open an ipython notebook via double click on osx
  • 如何为不同操作系统/Python 版本编译 Python C/C++ 扩展?

    我注意到一些成熟的Python库已经为大多数架构 Win32 Win amd64 MacOS 和Python版本提供了预编译版本 针对不同环境交叉编译扩展的标准方法是什么 葡萄酒 虚拟机 众包 我们使用虚拟机和Hudson http hud
  • Apache Beam Pipeline 写表后查询表

    我有一个 Apache Beam Dataflow 管道 它将结果写入 BigQuery 表 然后我想查询该表以获取管道的单独部分 但是 我似乎无法弄清楚如何正确设置此管道依赖性 我编写的新表 然后想要查询 与一个单独的表连接以进行某些过滤

随机推荐