Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A library to access Prestashop Web Service from Python.

Project Description
# Prestapyt

prestapyt is a library for Python to interact with the PrestaShop's Web Service API.

Learn more about the PrestaShop Web Service from the [Official Prestashop Documentation].

prestapyt is a direct port of the PrestaShop PHP API Client, PSWebServiceLibrary.php

Similar to PSWebServiceLibrary.php, prestapyt is a thin wrapper around the PrestaShop Web Service:
it takes care of making the call to your PrestaShop instance's Web Service,
supports the Web Service's HTTP-based CRUD operations (handling any errors)
and then returns the XML ready for you to work with in Python
(as well as prestasac if you work with scala).

## Installation

The easiest way to install prestapyt (needs setuptools):

easy_install prestapyt

Or, better, using pip:

pip install prestapyt

If you do not have setuptools, download prestapyt as a .tar.gz or .zip from
[Prestapyt Source Archives], untar it and run:

python install

## Usage

### Message as xml
from prestapyt import PrestaShopWebService
prestashop = PrestaShopWebService('http://localhost:8080/api', WEBSERVICE_KEY)

### Message as dictionary
from prestapyt import PrestaShopWebServiceDict
prestashop = PrestaShopWebServiceDict('http://localhost:8080/api', WEBSERVICE_KEY)

### Search

#### Get all addresses
prestashop.get('addresses') # will return the same xml message than'addresses')
Note: when using PrestaShopWebServiceDict ``'addresses')`` will return a list of ids.

#### Search with filters
```python'addresses', options={'limit': 10})'addresses', options={'display': '[firstname,lastname]', 'filter[id]': '[1|5]'})
For additional info [check reference for the options](

#### Get single address
prestashop.get('addresses', resource_id=1) or prestashop.get('addresses/1')
returns ElementTree (PrestaShopWebService) or dict (PrestaShopWebServiceDict).

You can use the full api URL


#### Head request


### Manipulate records

#### Delete
prestashop.delete('addresses', resource_ids=4)

#### Delete many records at once
prestashop.delete('addresses', resource_ids=[5,6])

#### Add record
prestashop.add('addresses', xml)

#### Edit record
prestashop.edit('addresses', xml)

#### Get model blank xml schema
prestashop.get('addresses', options={'schema': 'blank'})

#### Add product image

file_name = 'sample.jpg'
fd =, "rb")
content =

prestashop.add('/images/products/123', files=[('image', file_name, content)])

## API Documentation

Documentation for the PrestaShop Web Service can be found on the
PrestaShop wiki: [Using the REST webservice]

## Credits:

Thanks to Prestashop SA for their PHP API Client PSWebServiceLibrary.php

Thanks to Alex Dean for his port of PSWebServiceLibrary.php
to the Scala language, [prestasac] from which I also inspired my library.

## Copyright and License

prestapyt is copyright (c) 2012 Guewen Baconnier

prestapyt is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

prestapyt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with prestapyt. If not, see [GNU licenses](

[Official Prestashop Documentation]:
[Using the REST webservice]:
[Prestapyt Source Archives]:
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
prestapyt-0.8.0-py2.7.egg (28.3 kB) Copy SHA256 Checksum SHA256 2.7 Egg May 15, 2017
prestapyt-0.8.0-py2-none-any.whl (16.8 kB) Copy SHA256 Checksum SHA256 2.7 Wheel May 15, 2017
prestapyt-0.8.0.tar.gz (12.4 kB) Copy SHA256 Checksum SHA256 Source May 15, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting