Prestapyt和Prestashop 1.6.0.9,帖子错误

时间:2014-08-19 18:31:01

标签: python prestashop-1.6

我试图按照prestapyt给出的示例,我必须将产品和类别从csv文件同步到Prestashop,版本1.6.0.9。

prestapyt表示它可能与1.5.9.0以上版本不兼容。

在示例中,我的代码是:

#!/usr/bin/python
# -*- coding: utf-8 -*-

from prestapyt import PrestaShopWebService
from xml.etree import ElementTree


prestashop = PrestaShopWebService('http://myshop.com/api','mykey')
prestashop.debug = True

prestashop.get('')

print "ADD"
address = """
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<category>
<id></id>
<id_parent></id_parent>
<active>1</active>
<id_shop_default></id_shop_default>
<is_root_category></is_root_category>
<position></position>
<date_add></date_add>
<date_upd></date_upd>
<name><language id="1">Jackets Exp test</language><language id="2">Giacche exp prova</language></name>
<link_rewrite><language id="1"></language><language id="2"></language></link_rewrite>
<description><language id="1"></language><language id="2"></language></description>
<meta_title><language id="1"></language><language id="2"></language></meta_title>
<meta_description><language id="1"></language><language id="2"></language></meta_description>
<meta_keywords><language id="1"></language><language id="2"></language></meta_keywords>
<associations>
<categories>
<categories>
<id></id>
</categories>
</categories>
<products>
<products>
<id></id>
</products>
</products>
</associations>
</category>
</prestashop>
"""

prestashop.add('categories', address)

这是服务器端的答案

[error] [client **] [PHP Warning #2] SimpleXMLElement::__construct(): Entity: line 1:   parser error : Start tag expected, '<' not found   (**/prestashop/trunk/classes/webservice/WebserviceRequest.php, line 1454)
[error] [client **] [PHP Warning #2] SimpleXMLElement::__construct(): %0A%3Cprestashop+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E (**/prestashop/trunk/classes/webservice/WebserviceRequest.php, line 1454)
[error] [client **] [PHP Warning #2] SimpleXMLElement::__construct(): ^ (**/prestashop/trunk/classes/webservice/WebserviceRequest.php, line 1454)

所以听起来它是一个编码错误,我试图编辑prestapyt https://github.com/guewen/prestapyt/blob/master/prestapyt/prestapyt.py @ line 283删除urlencode,但它没有工作。救命!!! :d

0 个答案:

没有答案