Skip to main content

Prestashop Webservice Python API Client

Project description

The Python API for prestashop

Running the test against an existing server:

This file is also a test written in the doctest format. To run the example in this file against your installation of prestashop, replace the api key in the below example and run this file from the doctest module

$ python -m doctest -v README.rst

Example Usage:

Connecting to your store:

>>> from pystashop import PrestaShopWebservice
>>> client = PrestaShopWebservice(
...     '',
...     'X76XVCPE71843TIY5CPJVV3NX56Z4MVD')

Getting a list of customers:

>>> customers = client.customers.get_list(as_ids=True)
>>> type(customers)
<type 'list'>
>>> customers_count = len(customers)

Creating a customer:

>>> new_customer = client.customers.get_schema()
>>> new_customer.firstname = 'Sharoon'
>>> new_customer.lastname = 'Thomas'
>>> = ''
>>> customer = client.customers.create(new_customer)
>>> customer.firstname
>>> customer.lastname
>>> customers_list = client.customers.get_list()
>>> len(customers_list) == customers_count + 1
>>> in customers_list

Getting a single customer record:

>>> customer = client.customers.get(
>>> customer.firstname
>>> customer.lastname

Editing the customer details:

>>> = ''
>>> result = client.customers.update(, customer)
>>> updated_data = client.customers.get(

Choosing fields to display:

>>> customers = client.customers.get_list(display=['firstname', 'lastname'])
>>> isinstance(customers[0].firstname.pyval, basestring)
>>> isinstance(customers[0].lastname.pyval, basestring)
>>> isinstance(customers[0].id.pyval, int)

Filtering Records to Display:

>>> customers = client.customers.get_list(filters={'firstname': 'Sharoon'})
>>> customers[0].firstname

Deleting a customer:

>>> client.customers.delete(
>>> customers_list = client.customers.get_list()
>>> len(customers_list) == customers_count
>>> in customers_list

Project details

Download files

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

Source Distribution

pystashop-0.2.tar.gz (4.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page