I am trying to POST new XML resources to prestashop using Python, but it lists all the resources instead.
Assume that **URL_PRODS **and **CLAVE **are properly defined
def postNewProduct():
newProduct = requests.get(URL_PRODS, auth = HTTPBasicAuth(CLAVE,''), params = {'schema':'blank'})
product = newProduct.find('product')
product.find('id').text = '1000'
product.find('id_manufacturer').text = '100'
product.find('reference').text = 'AAAAAA'
product.find('width').text = '10'
product.find('height').text = '10'
product.find('depth').text = '10'
product.find('weight').text = '10'
product.find('price').text = '1'
try:
xml = ElementTree.tostring(product)
req = requests.post(URL_PRODS,data=xml,auth=HTTPBasicAuth(CLAVE,''),headers={'Content-Type':'text/xml'})
return req.text
except Exception as e:
return e
This code should create a product resource but it lists all the resources instead as if it was a GET