Skip to main content

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 setup.py install

Usage

from prestapyt import PrestaShopWebServiceError, PrestaShopWebService

prestashop = PrestaShopWebService(’http://localhost:8080/api’, ‘BVWPFFYBT97WKM959D7AVVD0M4815Y1L’) # messages will be as xml # or prestashop = PrestaShopWebServiceDict(’http://localhost:8080/api’, ‘BVWPFFYBT97WKM959D7AVVD0M4815Y1L’) # messages will be as dict

# search / get all addresses prestashop.get(‘addresses’) # will return the same xml message than prestashop.search(‘addresses’) # but when using PrestaShopWebServiceDict prestashop.search(‘addresses’) will return a list of ids

# search with filters prestashop.search(‘addresses’, options={‘limit’: 10}) prestashop.search(‘addresses’, options={‘display’: ‘[firstname,lastname]’, ‘filter[id]’: ‘[1|5]’}) # reference for the options : http://doc.prestashop.com/display/PS14/Cheat+Sheet_+Concepts+Outlined+in+this+Tutorial

# get address 1 prestashop.get(‘addresses’, resource_id=1) # returns ElementTree (PrestaShopWebService) or dict (PrestaShopWebServiceDict) prestashop.get(‘addresses/1’)

# full url prestashop.get(’http://localhost:8080/api/addresses/1’)

# head print prestashop.head(‘addresses’)

# delete a resource prestashop.delete(‘addresses’, resource_ids=4)

# delete many resources prestashop.delete(‘addresses’, resource_ids=[5,6])

# add prestashop.add(‘addresses’, xml)

# edit prestashop.edit(‘addresses’, 5, xml)

# get a blank xml prestashop.get(‘addresses’, options={‘schema’: ‘blank’})

# add product image file_name = ‘sample.jpg’ fd = io.open(file_name, “rb”) content = fd.read() fd.close()

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.

Metadata

Release files for prestapyt 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prestapyt 0.7.0
File Size Uploaded
prestapyt-0.7.0.tar.gz 12.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for prestapyt 0.7.0
File Interpreter ABI Platform
prestapyt-0.7.0-py2.7.egg Legacy Egg format - - Details
prestapyt-0.7.0-py2-none-any.whl Python 2 none any Details

Total release size: 56.4 kB

Release files / prestapyt-0.7.0.tar.gz

Download URL prestapyt-0.7.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1579dea1a5ff92954c0147d8a3e0ca8acccb4d24f3338db33a63569032529d74
BLAKE2b-256 checksum
How to use checksums
1096cc8c90e88656c02dcff9ddf9110c805a7ad64ee09118e7d6e648e4d9c040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / prestapyt-0.7.0-py2.7.egg

Download URL prestapyt-0.7.0-py2.7.egg
Size 27.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
42a8e11cf3349cd038be28a62ce42c41867403ed0d5bf8537bbf27a00a443ff2
BLAKE2b-256 checksum
How to use checksums
70cd88af11334390b79a145777ca1eaaec382262d749760d6d8da99989ba9778
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / prestapyt-0.7.0-py2-none-any.whl

Download URL prestapyt-0.7.0-py2-none-any.whl
Size 16.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
30648be316c87785e1fa258f602ee95e37d7fdf00fe262f22c9819a6ca8b2167
BLAKE2b-256 checksum
How to use checksums
8ed65ceabc54435c613f098794986932a0e96aa46706a452cb7785de3e9d0873
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.11.1

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.0

3 release files

0.8.0

3 release files

This release

0.7.0 This release

3 release files

0.6.3

3 release files

0.6.2

3 release files

0.6.1

3 release files

0.6.0

3 release files

0.5.3

3 release files

0.5.2

2 release files

0.5.1

3 release files

0.5.0

2 release files

0.4.0

3 release files

0.3.1

3 release files

0.3.0

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.1

3 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page