【问题标题】:How to programmatically create a collection on GSA with Python如何使用 Python 以编程方式在 GSA 上创建集合
【发布时间】:2014-10-02 17:31:06
【问题描述】:

我正在尝试使用 Administrative API 在 Google Search Appliance 上创建集合

我成功检索了授权令牌,但在发布 XML 以创建集合时,我收到有关我的 xml 的错误。

<errors xmlns=\'http://schemas.google.com/g/2005\'><error><domain>GData</domain><code>ParseException</code><internalReason>Element type "gsa:content" must be followed by either attribute specifications, "&gt;" or "/&gt;".</internalReason></error></errors>

这是我的有效载荷:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gsa='http://schemas.google.com/gsa/2007'>
<gsa:content name='collectionName'>testcollection</gsa:content>
<gsa:content name='insertMethod''>default</gsa:content>
</entry>

这是我的蟒蛇:

>> print headers
{'Content-Type': 'application/atom+xml', 'Authorization': 'GoogleLogin auth=googleauthtoken'}
>>> print url
http://GSA_ip:8000/feeds/collection
>>> r = requests.post(url, data=payload, headers=headers, verify=False)

【问题讨论】:

    标签: python xml google-search-appliance


    【解决方案1】:

    我是个瞎子:

    <gsa:content name='insertMethod''>default</gsa:content>
    

    两个单引号关闭我的 name 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-04
      • 1970-01-01
      • 2011-09-08
      • 1970-01-01
      • 2014-02-24
      • 2014-11-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多