1
我正在使用walmart partner api與python腳本。我正在嘗試使用httplib上傳項目文件。這裏是我的代碼:發佈項目沃爾瑪合作伙伴API Python
file = open('/opt/item.xml', 'rb')
headers = {
"Accept":ws_accept,
"WM_SVC.NAME": wm_svc_name,
"WM_CONSUMER.ID":wm_consumer_id,
"WM_SEC.TIMESTAMP": wm_sec_timestamp,
"WM_SEC.AUTH_SIGNATURE":wm_sec_auth_signature,
"WM_QOS.CORRELATION_ID": wm_qos_correlation_id,
"Content-Type": 'multipart/form-data; boundary=xxx',
"Host":'marketplace.walmartapis.com'
}
conn = httplib.HTTPSConnection('marketplace.walmartapis.com')
conn.request("POST", '/v2/feeds?feedType=item',file, headers)
response = conn.getresponse()
print response.status, response.reason
print 'response',response.read()
item.xml是機制的文檔提供的示例文件。
響應是在這裏:
500 Internal Server Error
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:errors xmlns:ns2="http://walmart.com/">
<ns2:error>
<ns2:code>SYSTEM_ERROR.GMP_GATEWAY_API</ns2:code>
<ns2:description>Couldn't find MIME boundary: --xxx</ns2:description>
<ns2:info>System encountered some internal error.</ns2:info>
<ns2:severity>ERROR</ns2:severity>
<ns2:category>DATA</ns2:category>
<ns2:causes/>
<ns2:errorIdentifiers/>
</ns2:error>
</ns2:errors>
希望有人熟悉沃爾瑪的合作伙伴API。否則建議與多部分邊界錯誤,我該如何解決這個問題,請幫助你們......
從哪裏獲得示例xml文件?你有樣品XML文件上傳產品的變化? –