我如何连接到博托现有CloudSearch域?连接到、CloudSearch

2023-09-11 11:10:26 作者:′炎ネ申辶ιīànヤ

我刚开始工作,并具博托连接到Amazon CloudSearch。

我的例子中工作,但我找不到连接到现有的域的任何的例子,所有的例子创建一个新的域。

闲逛,我发现get_domain,但如果我把它连接对象上失败。

 >>> conn.get_domain('富')
回溯(最近通话最后一个):
  文件<标准输入>中,1号线,与<模块>
AttributeError的:2层对象有没有属性'get_domain
 

任何建议,我怎么可以连接到现有的域名?

http://boto.cloudhackers.com/en/latest/cloudsearch_tut:我从这个开始。 HTML

所以,我做的这个

 进口博托
康恩= boto.connect_cloudsearch()
 

解决方案 正值618,它却悄悄涨价了

您可以做 conn.list_domains()将返回域的列表对象为所有您当前的域名,或者你可以做 conn.lookup('富')将返回域对象指定的域名。

I'm just starting to work with boto to connect to Amazon CloudSearch.

I got the examples working, but I can't find any examples of connecting to an existing domain, all the examples create a new domain.

Poking around, I found get_domain, but that fails if I call it on the connection object.

>>> conn.get_domain('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Layer2' object has no attribute 'get_domain'

Any suggestions as to how I can connect to an existing domain?

[edit] I started from this: http://boto.cloudhackers.com/en/latest/cloudsearch_tut.html

So, all I'm doing this

import boto
conn = boto.connect_cloudsearch()

解决方案

You can either do conn.list_domains() which will return a list of Domain objects for all of your current domains or you can do conn.lookup('foo') which will return a Domain object for the specified domain name.