{ "info": { "author": "Sharoon Thomas, Openlabs Technologies", "author_email": "info@openlabs.co.in", "bugtrack_url": null, "classifiers": [ "Development Status :: 6 - Mature", "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Python API for Prestashop\n=========================\n\nThe Python API for prestashop\n\nRunning the test against an existing server:\n--------------------------------------------\n\nThis file is also a test written in the doctest format. To run the example\nin this file against your installation of prestashop, replace the api key\nin the below example and run this file from the doctest module\n\n.. code:: sh\n\n $ python -m doctest -v README.rst\n\n\nExample Usage:\n--------------\n\nConnecting to your store::\n\n >>> from pystashop import PrestaShopWebservice\n >>> from datetime import datetime, timedelta\n >>> client = PrestaShopWebservice(\n ... 'http://prestashop.openlabs.co.in', \n ... 'X76XVCPE71843TIY5CPJVV3NX56Z4MVD')\n\nGetting a list of customers::\n\n >>> customers = client.customers.get_list(as_ids=True)\n >>> type(customers)\n \n >>> customers_count = len(customers)\n\nCreating customers::\n\n >>> new_customer = client.customers.get_schema()\n >>> new_customer.firstname = 'Sharoon'\n >>> new_customer.lastname = 'Thomas'\n >>> new_customer.email = 'st@openlabs.co.in'\n >>> customer = client.customers.create(new_customer)\n >>> customer.firstname\n 'Sharoon'\n >>> customer.lastname\n 'Thomas'\n >>> new_customer2 = client.customers.get_schema()\n >>> new_customer2.firstname = 'Test'\n >>> new_customer2.lastname = 'Customer'\n >>> new_customer2.email = 'test@openlabs.co.in'\n >>> customer2 = client.customers.create(new_customer2)\n >>> customers_list = client.customers.get_list(as_ids=True)\n >>> len(customers_list) == customers_count + 2\n True\n >>> customer.id in customers_list\n True\n\nGetting a single customer record::\n\n >>> customer = client.customers.get(customer.id)\n >>> customer.firstname\n 'Sharoon'\n >>> customer.lastname\n 'Thomas'\n\nEditing the customer details::\n\n >>> customer.email = 'info@openlabs.co.in'\n >>> result = client.customers.update(customer.id, customer)\n >>> updated_data = client.customers.get(customer.id)\n >>> updated_data.email\n 'info@openlabs.co.in'\n\n\nChoosing fields to display::\n\n >>> customers = client.customers.get_list(\n ... display=['id', 'firstname', 'lastname']\n ... )\n >>> isinstance(customers[0].firstname.pyval, basestring)\n True\n >>> isinstance(customers[0].lastname.pyval, basestring)\n True\n >>> isinstance(customers[0].id.pyval, int)\n True\n\nFiltering Records to Display::\n\n >>> customers = client.customers.get_list(\n ... filters={'firstname': 'Sharoon'},\n ... display=['firstname']\n ... )\n >>> customers[0].firstname.pyval\n 'Sharoon'\n\nFiltering Records on basis of date::\n\n >>> customers = client.customers.get_list(\n ... filters={\n ... 'date_add': '{0},{1}'.format(\n ... '2012-01-01 00:00:00',\n ... datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')\n ... ),\n ... 'firstname': 'Sharoon',\n ... },\n ... display=['firstname'], date=True,\n ... )\n >>> customers[0].firstname.pyval\n 'Sharoon'\n >>> time_diff = timedelta(hours=5)\n >>> time_now = datetime.utcnow()\n >>> customers = client.customers.get_list(\n ... filters={\n ... 'date_add': '{0},{1}'.format(\n ... time_now.strftime('%Y-%m-%d %H:%M:%S'),\n ... (time_now + time_diff).strftime(\n ... '%Y-%m-%d %H:%M:%S')\n ... ),\n ... 'firstname': 'Sharoon',\n ... },\n ... display=['firstname'], date=True,\n ... )\n >>> len(customers)\n 0\n\nSorting Records to be displayed::\n\n >>> customers = client.customers.get_list(\n ... display=['firstname'],\n ... sort=[('firstname', 'DESC')]\n ... )\n >>> customers[0].firstname.pyval\n 'Test'\n >>> customers = client.customers.get_list(\n ... display=['lastname'],\n ... sort=[('lastname', 'DESC')]\n ... )\n >>> customers[0].lastname.pyval\n 'Thomas'\n\nLimiting and offsetting records to be displayed::\n\n >>> customer_list1 = client.customers.get_list(\n ... as_ids=True, limit=1\n ... )\n >>> len(customer_list1)\n 1\n >>> customer_list2 = client.customers.get_list(\n ... as_ids=True, offset=2, limit=1\n ... )\n >>> len(customer_list2)\n 1\n >>> customer_list1 == customer_list2\n False\n\nDeleting a customer::\n\n >>> client.customers.delete(customer.id)\n True\n >>> customers_list = client.customers.get_list(as_ids=True)\n >>> len(customers_list) == customers_count + 1\n True\n >>> customer.id in customers_list\n False", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/openlabs/pystashop/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pystashop", "package_url": "https://pypi.org/project/pystashop/", "platform": "any", "project_url": "https://pypi.org/project/pystashop/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/openlabs/pystashop/" }, "release_url": "https://pypi.org/project/pystashop/0.4/", "requires_dist": null, "requires_python": null, "summary": "Prestashop Webservice Python API Client", "version": "0.4" }, "last_serial": 806435, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a6692f2572861b451a5f87f4838a4d4a", "sha256": "7f1916586da9360087252f002136bffe36e21149cd4130bbef95876a490b7998" }, "downloads": -1, "filename": "pystashop-0.1.tar.gz", "has_sig": false, "md5_digest": "a6692f2572861b451a5f87f4838a4d4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3541, "upload_time": "2013-05-28T14:27:45", "url": "https://files.pythonhosted.org/packages/7d/06/73eb3f8cd775fe51d741641b41390f1535f64baa62e5357d76da03ffe540/pystashop-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "c2b607978a02764e722aed38c453b81f", "sha256": "f7dcd0fe4dc049b58c85b1fb724b64685d7a270b8446b38e9bc15d31e58a3406" }, "downloads": -1, "filename": "pystashop-0.2.tar.gz", "has_sig": false, "md5_digest": "c2b607978a02764e722aed38c453b81f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4508, "upload_time": "2013-06-08T09:37:13", "url": "https://files.pythonhosted.org/packages/16/14/4ea8cf8cc558cb09054a9760ecd004ef0b66259805609c9d96f383caf0f3/pystashop-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "faf7001e84a4b2818e971fd0cfc61413", "sha256": "cc298463b8af43e23dc6eba4942c2f1cb699136d3ed47e42f465ed15337bcaf4" }, "downloads": -1, "filename": "pystashop-0.3.tar.gz", "has_sig": false, "md5_digest": "faf7001e84a4b2818e971fd0cfc61413", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6508, "upload_time": "2013-07-02T18:41:17", "url": "https://files.pythonhosted.org/packages/bb/53/fd7b5180a3d21c1e62c6b8f787744d48ab1ea5dc171712123f426f6318b2/pystashop-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "3cb2377000f8c4f68eb713dbdf13711d", "sha256": "490eec441574b2293b99e3431abbdd3bc001ebc61fdace44d17a9e4c1af41d1f" }, "downloads": -1, "filename": "pystashop-0.4.tar.gz", "has_sig": false, "md5_digest": "3cb2377000f8c4f68eb713dbdf13711d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27115, "upload_time": "2013-07-02T18:45:57", "url": "https://files.pythonhosted.org/packages/89/d9/e37be064f33c64e8b4078e20123a85d314beebce2a38916dd3d7b3fdb3da/pystashop-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3cb2377000f8c4f68eb713dbdf13711d", "sha256": "490eec441574b2293b99e3431abbdd3bc001ebc61fdace44d17a9e4c1af41d1f" }, "downloads": -1, "filename": "pystashop-0.4.tar.gz", "has_sig": false, "md5_digest": "3cb2377000f8c4f68eb713dbdf13711d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27115, "upload_time": "2013-07-02T18:45:57", "url": "https://files.pythonhosted.org/packages/89/d9/e37be064f33c64e8b4078e20123a85d314beebce2a38916dd3d7b3fdb3da/pystashop-0.4.tar.gz" } ] }