{ "info": { "author": "Nimesh Kiran Verma, Rohit khatana", "author_email": "nimesh.aug11@gmail.com, rohitkhatana.khatana@gmail.com", "bugtrack_url": null, "classifiers": [], "description": ".. figure:: https://raw.githubusercontent.com/nimeshkverma/E-Cart/master/images/ecart.png\r\n :alt: \r\n\r\nE-Cart is a framework agnostic, redis backed, cart system, built in\r\nPython. It is not a POS, or a full fledged ecommerce system.\r\n\r\nInstallation\r\n------------\r\n\r\n::\r\n\r\n pip install ecart\r\n\r\nRequirements\r\n------------\r\n\r\n.. figure:: https://raw.githubusercontent.com/nimeshkverma/E-Cart/master/images/redis_logo.png\r\n :alt: \r\n\r\nAs E-Cart harnesses the power of Redis.You should have running `Redis\r\nServer `__. and installed\r\n**redis-py** `redis-py `__ package.\r\n\r\nBasic Usage\r\n-----------\r\n\r\n1. Import the ``Cart`` class from the ``ecart`` package:\r\n\r\n ``from ecart.ecart import Cart``\r\n\r\n2. Create a new shopping cart:\r\n\r\n ``cart_obj = Cart(user_id, redis_connection, ttl)``\r\n\r\n ``user_id`` : This a required parameter which acts as a unique\r\n identifier for the cart. If you don't want a user to have more than\r\n one cart at a time, it's generally best to set this to the user's id.\r\n\r\n ``redis_connection``: This too is a required field and is used to\r\n communicate with the Redis database. This is basically a redis\r\n connection object obtained by calling the ``redis.Redis()`` function\r\n of the `redis\r\n package `__. An sample\r\n function to create such object is available at\r\n `redis\\_connection.py `__\r\n\r\n ``ttl``: This field used to set the expiry time of the user cart in\r\n the Redis in seconds. This is an optional field with a default value\r\n of 604800.\r\n\r\n3. To add an item to the cart:\r\n\r\n ``cart_obj.add(product_id, unit_cost, quantity)``\r\n\r\n This function take ``product_id``, ``unit_cost`` and ``quantity`` and\r\n other details (``**kwargs``) if you like. Once executed this function\r\n add the given product and its details into the user cart in redis db.\r\n\r\n4. To Retrieve the items:\r\n\r\n``cart_obj.get()``\r\n\r\n::\r\n\r\n This function returns the complete cart of the user, basically a dictionary of product_id to product_details dictionary.\r\n\r\nFunctions Exposed\r\n-----------------\r\n\r\nFollowing are the complete details of the methods exposed by\r\n``cart_obj`` object:\r\n\r\n- **add**\r\n\r\n ``add(product_id, unit_cost, quantity, **extra_details)``\r\n\r\n This function is the life blood of E-Cart. Below are the details of\r\n the arguments for the *add* function:\r\n\r\n - ``product_id``: (*required*) to store the ID of the model you're\r\n adding\r\n - ``quantity``: (*required*) which will let you use the\r\n ``Cart#quantity`` and ``Cart#total`` methods without any extra\r\n configuration.\r\n - ``unit_cost``: (*required*) which will help you to calculate total\r\n value of cart.\r\n - ``extra_details``:(*optional*) if you want to store any extra\r\n information about the cart item just pass the details as\r\n \\*\\*kwargs, ecart will take care of it.\r\n\r\n- **remove**\r\n\r\n ``remove(product_id)``\r\n\r\n As you would have guessed, removes an item of the input\r\n ``product_id``\r\n\r\n- **contains**\r\n\r\n ``contains(product_id)``\r\n\r\n Returns a Boolean indicating whether an item of the given\r\n ``product_id`` is in the cart or not.\r\n\r\n- **get\\_product**\r\n\r\n ``get_product(product_id)``\r\n\r\n For the input ``product_id``, this function will return the ``Item``\r\n dictionary with ``unit_cost``, ``quantity`` etc details.\r\n\r\n- **get**\r\n\r\n ``get()``\r\n\r\n This function returns the complete cart of the user, basically a\r\n dictionary of product\\_id to product\\_details dictionary.\r\n\r\n- **total\\_cost**\r\n\r\n ``total_cost()``\r\n\r\n This will return the sum all of the ``cost`` return values of all of\r\n the items in the cart. For this to work, the ``:unit_cost`` and\r\n ``:quantity`` fields need to be set for all items.\r\n\r\n- **count**\r\n\r\n ``count()``\r\n\r\n This will return the total number of items in the cart. Faster than\r\n ``cart.items.size`` because it doesn't load all of the item data from\r\n redis.\r\n\r\n- **quantity**\r\n\r\n ``quantity()``\r\n\r\n This will return the total quantity of all the items. The quantity\r\n field is set in the config block, by default it's ``:quantity``\r\n\r\n- **get\\_ttl**\r\n\r\n ``get_ttl()``\r\n\r\n This will return the number of seconds until the cart expires.\r\n\r\n- **set\\_ttl**\r\n\r\n ``set_ttl(ttl_value)``\r\n\r\n This will set the ttl of the user cart in redis to ``ttl_value``.\r\n ``ttl_value`` must be integer and is in seconds\r\n\r\n- **destroy**\r\n\r\n ``destroy()``\r\n\r\n This will delete the cart, and all the line\\_items out of it.\r\n\r\n- **copy**\r\n\r\n ``copy(new_id)``\r\n\r\n This method will copy the current cart to the new unique\\_id. Will be\r\n useful for copying guest user's cart to logged-in user's cart or\r\n simply creating a copy of the cart.\r\n\r\nExample\r\n-------\r\n\r\nLets walk through an example below:\r\n\r\n.. code:: python\r\n\r\n from ecart.ecart import Cart\r\n cart = Cart(user_id, reddis_connection) # ttl is optional default is 604800\r\n cart.add(product_id, unit_cost, quantity) # quantity defaults to 1, also you can pass optional dict(extra info)\r\n cart.total\r\n cart.quantity\r\n\r\nHow to Contribute\r\n-----------------\r\n\r\n1. Fork it\r\n2. Create your feature branch (``git checkout -b my-new-feature``)\r\n3. Commit your changes (``git commit -am 'Add some feature'``)\r\n4. Push to the branch (``git push origin my-new-feature``)\r\n5. Create new Pull Request", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/nimeshkverma/E-cart/tarball/1.0.2", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nimeshkverma/E-cart", "keywords": "ecart,cart,redis,E-commerce,webservices", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "", "name": "ecart", "package_url": "https://pypi.org/project/ecart/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ecart/", "project_urls": { "Download": "https://github.com/nimeshkverma/E-cart/tarball/1.0.2", "Homepage": "https://github.com/nimeshkverma/E-cart" }, "release_url": "https://pypi.org/project/ecart/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "Framework agnostic, redis backed, cart system, Python library", "version": "1.0.2" }, "last_serial": 2261965, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f8d0961c43e4046fc94b4c27de01a337", "sha256": "a5032ad14e016aaea38a5e7c28a78ba2980ef9a8231a2259f966dee3578009b1" }, "downloads": -1, "filename": "ecart-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f8d0961c43e4046fc94b4c27de01a337", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2777, "upload_time": "2016-05-07T21:28:41", "url": "https://files.pythonhosted.org/packages/b1/7e/feab2ea75f6d9a3d620f7a721ec3a6bb500d7fa2f95378907d755a0982bc/ecart-1.0.0.tar.gz" } ], "1.0.1": [], "1.0.2": [ { "comment_text": "", "digests": { "md5": "d611c20d4a38e76865abcf91a680c161", "sha256": "8b1678dba1d8507f51b32bcc9b54572e66a46f2486aae4e8f64a30b863158ad3" }, "downloads": -1, "filename": "ecart-1.0.2.tar.gz", "has_sig": false, "md5_digest": "d611c20d4a38e76865abcf91a680c161", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4873, "upload_time": "2016-05-09T14:42:35", "url": "https://files.pythonhosted.org/packages/4c/d2/f0f8b97f153cbcf35539aa13e925e30cd35cfb3fa60597cd69f471cbf717/ecart-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d611c20d4a38e76865abcf91a680c161", "sha256": "8b1678dba1d8507f51b32bcc9b54572e66a46f2486aae4e8f64a30b863158ad3" }, "downloads": -1, "filename": "ecart-1.0.2.tar.gz", "has_sig": false, "md5_digest": "d611c20d4a38e76865abcf91a680c161", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4873, "upload_time": "2016-05-09T14:42:35", "url": "https://files.pythonhosted.org/packages/4c/d2/f0f8b97f153cbcf35539aa13e925e30cd35cfb3fa60597cd69f471cbf717/ecart-1.0.2.tar.gz" } ] }