2014-10-02 1 views
-1

Я пытаюсь создать коллекцию на Google Search Appliance с помощью Administrative APIКак программно создать коллекцию на GSA с Python

Я успешно получить разрешение маркера, но при публикации 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) 

ответ

0

Я слепой дурак:

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

Две одиночные кавычки закрытия мой атрибут имени.