prestapyt


Nameprestapyt JSON
Version 0.11.1 PyPI version JSON
download
home_pagehttp://github.com/prestapyt/prestapyt
SummaryA library to access Prestashop Web Service from Python.
upload_time2022-08-15 09:17:12
maintainer
docs_urlNone
authorGuewen Baconnier
requires_python
licenseGNU AGPL-3
keywords prestashop api client rest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

In order to always be uptodate, the best way is to use pip from this repo with the following command :

    pip install --ignore-installed git+https://github.com/prestapyt/prestapyt.git@master

## Usage


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

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

### Search

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


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

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

You can use the full api URL

```python
prestashop.get('http://localhost:8080/api/addresses/1')
```

#### Head request

```python
prestashop.head('addresses')
```

### Manipulate records

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

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

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

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

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

#### Add product image

```python
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.


## 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
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](http://www.gnu.org/licenses/).



[Official Prestashop Documentation]: http://doc.prestashop.com/display/PS14/Using+the+REST+webservice
[Using the REST webservice]: http://doc.prestashop.com/display/PS14/Using+the+REST+webservice
[Prestapyt Source Archives]: https://github.com/guewen/prestapyt/downloads
[prestasac]: https://github.com/orderly/prestashop-scala-client

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/prestapyt/prestapyt",
    "name": "prestapyt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "prestashop api client rest",
    "author": "Guewen Baconnier",
    "author_email": "guewen.baconnier@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2b/d9/a65da349392fa3e0ab25b29cf61376c725b5430508cc13005b6366f7d174/prestapyt-0.11.1.tar.gz",
    "platform": null,
    "description": "# Prestapyt\n\nprestapyt is a library for Python to interact with the PrestaShop's Web Service API.\n\nLearn more about the PrestaShop Web Service from the [Official Prestashop Documentation].\n\nprestapyt is a direct port of the PrestaShop PHP API Client, PSWebServiceLibrary.php\n\nSimilar to PSWebServiceLibrary.php, prestapyt is a thin wrapper around the PrestaShop Web Service:\nit takes care of making the call to your PrestaShop instance's Web Service,\nsupports the Web Service's HTTP-based CRUD operations (handling any errors)\nand then returns the XML ready for you to work with in Python\n(as well as prestasac if you work with scala).\n\n## Installation\n\nThe easiest way to install prestapyt (needs setuptools):\n\n    easy_install prestapyt\n\nOr, better, using pip:\n\n    pip install prestapyt\n\nIf you do not have setuptools, download prestapyt as a .tar.gz or .zip from\n[Prestapyt Source Archives], untar it and run:\n\n    python setup.py install\n\nIn order to always be uptodate, the best way is to use pip from this repo with the following command :\n\n    pip install --ignore-installed git+https://github.com/prestapyt/prestapyt.git@master\n\n## Usage\n\n\n### Message as xml\n```python\nfrom prestapyt import PrestaShopWebService\nprestashop = PrestaShopWebService('http://localhost:8080/api', WEBSERVICE_KEY)\n```\n\n### Message as dictionary\n```python\nfrom prestapyt import PrestaShopWebServiceDict\nprestashop = PrestaShopWebServiceDict('http://localhost:8080/api', WEBSERVICE_KEY)\n```\n\n### Search\n\n#### Get all addresses\n```python\nprestashop.get('addresses') # will return the same xml message than\nprestashop.search('addresses')\n```\nNote: when using PrestaShopWebServiceDict ``prestashop.search('addresses')`` will return a list of ids.\n\n\n#### Search with filters\n```python\nprestashop.search('addresses', options={'limit': 10})\nprestashop.search('addresses', options={'display': '[firstname,lastname]', 'filter[id]': '[1|5]'})\n```\nFor additional info [check reference for the options](http://doc.prestashop.com/display/PS14/Cheat+Sheet_+Concepts+Outlined+in+this+Tutorial).\n\n#### Get single address\n```python\nprestashop.get('addresses', resource_id=1) or prestashop.get('addresses/1')\n```\nreturns ElementTree (PrestaShopWebService) or dict (PrestaShopWebServiceDict).\n\nYou can use the full api URL\n\n```python\nprestashop.get('http://localhost:8080/api/addresses/1')\n```\n\n#### Head request\n\n```python\nprestashop.head('addresses')\n```\n\n### Manipulate records\n\n#### Delete\n```python\nprestashop.delete('addresses', resource_ids=4)\n```\n\n#### Delete many records at once\n```python\nprestashop.delete('addresses', resource_ids=[5,6])\n```\n\n#### Add record\n```python\nprestashop.add('addresses', xml)\n```\n\n#### Edit record\n```python\nprestashop.edit('addresses', xml)\n```\n\n#### Get model blank xml schema\n```python\nprestashop.get('addresses', options={'schema': 'blank'})\n```\n\n#### Add product image\n\n```python\nfile_name = 'sample.jpg'\nfd = io.open(file_name, \"rb\")\ncontent = fd.read()\nfd.close()\n\nprestashop.add('/images/products/123', files=[('image', file_name, content)])\n```\n\n## API Documentation\n\nDocumentation for the PrestaShop Web Service can be found on the\nPrestaShop wiki: [Using the REST webservice]\n\n\n## Credits:\n\nThanks to Prestashop SA for their PHP API Client PSWebServiceLibrary.php\n\nThanks to Alex Dean for his port of PSWebServiceLibrary.php\nto the Scala language, [prestasac] from which I also inspired my library.\n\n\n## Copyright and License\n\nprestapyt is copyright (c) 2012 Guewen Baconnier\n\nprestapyt is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as\npublished by the Free Software Foundation, either version 3 of\nthe License, or (at your option) any later version.\n\nprestapyt is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public\nLicense along with prestapyt. If not, see [GNU licenses](http://www.gnu.org/licenses/).\n\n\n\n[Official Prestashop Documentation]: http://doc.prestashop.com/display/PS14/Using+the+REST+webservice\n[Using the REST webservice]: http://doc.prestashop.com/display/PS14/Using+the+REST+webservice\n[Prestapyt Source Archives]: https://github.com/guewen/prestapyt/downloads\n[prestasac]: https://github.com/orderly/prestashop-scala-client\n",
    "bugtrack_url": null,
    "license": "GNU AGPL-3",
    "summary": "A library to access Prestashop Web Service from Python.",
    "version": "0.11.1",
    "project_urls": {
        "Homepage": "http://github.com/prestapyt/prestapyt"
    },
    "split_keywords": [
        "prestashop",
        "api",
        "client",
        "rest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd1b2ff05cda7c6f2e3fbeba71254f8c7187192b5d04c56f540661daeee463d1",
                "md5": "66ac030ad712f62a6cecfe494646e792",
                "sha256": "1dd49d9dccb8c27a35e760c9813e48704b0a659e80cf501f655be11c171e612f"
            },
            "downloads": -1,
            "filename": "prestapyt-0.11.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "66ac030ad712f62a6cecfe494646e792",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 26463,
            "upload_time": "2022-08-15T09:17:11",
            "upload_time_iso_8601": "2022-08-15T09:17:11.519098Z",
            "url": "https://files.pythonhosted.org/packages/fd/1b/2ff05cda7c6f2e3fbeba71254f8c7187192b5d04c56f540661daeee463d1/prestapyt-0.11.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2bd9a65da349392fa3e0ab25b29cf61376c725b5430508cc13005b6366f7d174",
                "md5": "ef7b314c460de3c20fa74b45924c6590",
                "sha256": "bebd1980f25822ddeeb908f3452755d9213e902c8dbd8e8195fe08eb8eca1341"
            },
            "downloads": -1,
            "filename": "prestapyt-0.11.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ef7b314c460de3c20fa74b45924c6590",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28095,
            "upload_time": "2022-08-15T09:17:12",
            "upload_time_iso_8601": "2022-08-15T09:17:12.813250Z",
            "url": "https://files.pythonhosted.org/packages/2b/d9/a65da349392fa3e0ab25b29cf61376c725b5430508cc13005b6366f7d174/prestapyt-0.11.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-15 09:17:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "prestapyt",
    "github_project": "prestapyt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "prestapyt"
}
        
Elapsed time: 0.10215s