Skip to main content

Prestashop

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

Learn more about the Prestashop Web Service from the Official Documentation

Installation

using pip :

pip install prestashop

the git repo:

git clone https://github.com/AiSyS-Next/prestashop 
cd prestashop
pip install . 

Usage

init api

for json data format

from prestashop import Prestashop, Format

api = Prestashop(
    url = "https://myprestashop.com",
    api_key="4MV3E41MFR7E3N9VNJE2W5EHS83E2EMI",
    default_lang=1,
    debug=True,
    data_format=Format.JSON,
)

for xml data format

from prestashop import Prestashop, Format

api = Prestashop(
    url = "https://myprestashop.com",
    api_key="4MV3E41MFR7E3N9VNJE2W5EHS83E2EMI",
    default_lang=1,
    debug=True,
    data_format=Format.XML,
)

Test API

test if you webservice run

api.ping()

Create Record

data = {
        'tax':{
            'rate' : 3.000,
            'active': '1',
            'name' : {
                'language' : {
                    'attrs' : {'id' : '1'},
                    'value' : '3% tax'
                }
            }
        }
    }

rec = api.create('taxes',data)

Add product image

file_name = 'sample.jpg'

api.create_binary('images/products/30',file=file_name , _type='image')

Update record

update_data = {
        'tax':{
            'id' : str(rec['id']),
            'rate' : 3.000,
            'active': '1',
            'name' : {
                'language' : {
                    'attrs' : {'id' : '1'},
                    'value' : '3% tax'
                }
            }
        }
    }

update_rec = api.write('taxes',update_data)

Remove record

api.unlink('taxes',str(rec['id']))

remove many records at once

api.unlink('taxes',[2,4,5])

Read

import pprint
result = api.read('taxes','2',display='[id,name]')

pprint(result)
 # search the first 3 taxes with 5 in the name 
import pprint
recs = api.search('taxes',_filter='[name]=%[5]%',limit='3')

for rec in recs:
    pprint(rec)


# search with id = 3 or id = 5

recs = api.search('taxes' ,_filter='[id]=[3 | 5]')

prestashop is copyright (c) 2023 Aymen Jemi (AISYSNEXT)

prestashop is free software: you can redistribute it and/or modify it under the terms of the GPLv3 General Public License as published by the Free Software Foundation, version 3 of the License .

Metadata

Release files for prestashop 0.1.8

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

Source distribution (sdist)

Source distribution for prestashop 0.1.8
File Size Uploaded Provenance
prestashop-0.1.8.tar.gz 20.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for prestashop 0.1.8
File Interpreter ABI Platform
prestashop-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 41.9 kB

Release files / prestashop-0.1.8.tar.gz

Download URL prestashop-0.1.8.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ae165d2a746b319d7ac8c76a2716b3439b36716f47d843d193c998a2fc4407a7
BLAKE2b-256 checksum
How to use checksums
fbec2b5e4e7290935a8d8938dcd3e5a918184868a65b19304148638ebccce71a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / prestashop-0.1.8-py3-none-any.whl

Download URL prestashop-0.1.8-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a21d4411f41dcfc969c6e3c5c9e3b220916d3cb0fa7d41c4db475e6be0458503
BLAKE2b-256 checksum
How to use checksums
90c5c5a33baa24a401a65fe76a7b0eafd7df15fb0086ec85aeb406f0c4ce2939
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Security for prestashop 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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