carolinalour Posted September 10, 2016 Share Posted September 10, 2016 Hi everyone! First of all, this is a duplicate of THIS because I'm not sure where this topic lands... I'm trying to create a script to add products to Prestashop, using Python. I'm using prestapyt library (https://github.com/prestapyt/prestapyt). My problem is that I can read products, I can get the template for a new product but I cannot UPLOAD or EDIT a new product, since it gives me a 400error - Bad request. I've done the following: 1- I've added myself to a Webservice to get a key, with ALL permissions, I've activated it and I've activated the CGI for PHP. 2- I've asked my server provider to enable everything from their side, which they did. I've created the following script: from prestapyt import PrestaShopWebServicefrom prestapyt import PrestaShopWebServiceDict from xml.etree import ElementTree from pprint import pprint DEBUG = 'true' PS_SHOP_PATH = 'http://uk01.tmd.cloud/~craftypa/prestashop/' PS_WS_AUTH_KEY ='something' prestashop = PrestaShopWebServiceDict(PS_SHOP_PATH,PS_WS_AUTH_KEY) address_data = prestashop.get('products', 1) address_data['active'] = '0' prestashop.edit('products', 1, address_data) Even though I can run the "get" command (and I actually get that product), I cannot run this last line, getting the following error: Traceback (most recent call last): File "Script.py", line 24, in <module> prestashop.edit('products', 1, address_data) File "build/bdist.macosx-10.11-intel/egg/prestapyt/prestapyt.py", line 363, in edit File "build/bdist.macosx-10.11-intel/egg/prestapyt/prestapyt.py", line 516, in edit_with_url File "build/bdist.macosx-10.11-intel/egg/prestapyt/prestapyt.py", line 374, in edit_with_url File "build/bdist.macosx-10.11-intel/egg/prestapyt/prestapyt.py", line 196, in _execute File "build/bdist.macosx-10.11-intel/egg/prestapyt/prestapyt.py", line 127, in _check_status_code prestapyt.prestapyt.PrestaShopWebServiceError: 'PrestaShop error: 400 Bad Request. Internal error. To see this error please display the PHP errors.' Any idea on how to solve this? I've been trying for a week now! Thank you! Carolina Link to comment Share on other sites More sharing options...
carolinalour Posted September 11, 2016 Author Share Posted September 11, 2016 Please help, I saw supposed to launch this store tomorrow but because of this it's super delayed. Do you have any other suggestion on how to do it? Thank you!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now