{ "info": { "author": "Mikkel Jans", "author_email": "mikkeljans@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "pyconomics is a python client/abstraction for the e-conomic API (e-conomic.com)\n\n\nInstallation\n------------\n\npip install pyconomic\n\n\nBasic Usage\n-----------\n\n # startup\n >>> import pyconomic\n >>> from pyconomic import models\n >>> pycon = pyconomic.Pyconomic(agreement_nr, user_id, password)\n\n # get / create base models\n >>> random_account = pycon.find(models.DebtorGroup)[0].account\n >>> terms = pycon.get(models.TermOfPayment, name='Net 8 days')\n >>> debtor_group = pycon.get_or_create(models.DebtorGroup, name='Test Group', number=123, account=random_account)\n >>> currency = pycon.get_or_create(models.Currency, code='DKK')\n\n # create debtor - you can also use \"pycon.create(models.Debtor, ..)\", all \"create_\" methods are facade methods to help construct all the input\n >>> john = pycon.create_debtor(debtor_group, 'John Doe', terms, pyconomic.VatZone.Domestic, currency, address='Somewhere', city='LongAgo', country='FarFarAway')\n\n # pyconomic will cache all instances, so the john-instance should be in the any new query of debtors from the server\n >>> debtors = pycon.find(models.Debtor, partial_name='John*')\n >>> john in debtors and debtors[0].name == 'John Doe'\n True\n\n # create products\n >>> product_group = pycon.find(models.ProductGroup)[0] # use a random product group\n >>> service = pycon.create_product('1000', product_group, 'Consulting Service', 300, description='I Do Stuff')\n >>> thing = pycon.create_product('1001', product_group, 'Thing', 1200, description='Thing in black')\n\n # create orders\n >>> order1 = pycon.create_order(john, products=[service, thing])\n\n # first time accessing a list-property like \"orders\" will do a server-call, and cache result for next access\n >>> john.orders\n []\n\n # which means that any new orders will not show up on the orders property\n >>> order2 = pycon.create_order(john, products=[thing])\n >>> len(john.orders)\n 1\n\n # use fetch to ask the server for new data\n >>> john.orders.fetch()\n [, ]\n >>> len(john.orders)\n 2\n\n # instances also has a fetch.. Reload the product data of the first order-line in the first of johns orders (for the fun of it):\n >>> john.orders[0].lines[0].product.fetch()\n \n\n # updating data - pycon.commit() will send all changes to server\n >>> orderline = john.orders[0].lines[0]\n >>> orderline.quantity = 3\n >>> pycon.get_all_changes()[models.OrderLine]\n [ {'quantity': 3}>]\n >>> pycon.commit()\n >>> pycon.get_all_changes()[models.OrderLine]\n []\n >>> orderline.quantity\n 3\n\n # upgrade order to invoice (must not be sent)\n >>> pycon.upgrade_to_invoice(order1)\n \n\n # send order\n >>> order2.is_sent\n False\n >>> pycon.send_order(order2)\n >>> order2.fetch().is_sent\n True\n\n # save order-pdf to the file \"orderpdf.pdf\" in the current working directory\n >>> order2.pdf.save('orderpdf')\n\n # delete everything again, orders seems be deleted as the debtor is deleted\n >>> john.delete()\n >>> service.delete()\n >>> thing.delete()\n\n\nNotes\n-----\n\n* Model instances are cached and reused based on their handle\n* The \"find\", \"get\", and \"get_or_create\" requires available \"TYPE_FindBy[X]\" server-method, and will make multiple server-calls if needed\n* Once a single instance needs its data, it will fetch the data of all instances in the cache by that type\n* List properties require a separate server-call:\n [debtor.invoices for debtor in debtors] would be as many server-calls as there's debtors, while getting attribute \"name\" is only 1 server-call to get all names\n* Changes in data is only saved on pycon.commit() except for Create and Delete which saves immediately\n\nTo-Do\n-----\n\n* add \"updated since\" query\n* create more facade methods, only has a few (create_order, create_products, ...) - use pycon.create([Model], **arguments) for the rest\n* update cache on create; doing create_orderline should update all the \"order.lines\" properties - use \".fetch()\" to update data instead\n* properties are missing a \"read_only\" state, so the user wont try to change data that cannot be saved\n* see if possible to create a data-model that is more IDE auto-complete friendly\n* add missing enums, only got for VatZone\n*", "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/mikkeljans/pyconomic", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pyconomic", "package_url": "https://pypi.org/project/pyconomic/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyconomic/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mikkeljans/pyconomic" }, "release_url": "https://pypi.org/project/pyconomic/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Abstraction for e-conomic.com API", "version": "0.1.2" }, "last_serial": 830513, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "83607c9ca8ec81e325e9de5e9d1ea2e8", "sha256": "de6bce85354d8ac9acb16c66aac71a13a412a98c120df24f7a795bc0f40adfbe" }, "downloads": -1, "filename": "pyconomic-0.1.0.tar.gz", "has_sig": false, "md5_digest": "83607c9ca8ec81e325e9de5e9d1ea2e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14936, "upload_time": "2013-08-01T22:05:23", "url": "https://files.pythonhosted.org/packages/a4/a2/c3a15ed39a6b8997dda68259f54bbbc42689f027abb361456ce27cc33cc7/pyconomic-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6acfb1b3363e5223bb76954f419e6b34", "sha256": "838020d7738dc128ac244764bb573f135c3452b656fca946ec82e4a46fc99a26" }, "downloads": -1, "filename": "pyconomic-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6acfb1b3363e5223bb76954f419e6b34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14928, "upload_time": "2013-08-01T22:08:07", "url": "https://files.pythonhosted.org/packages/68/21/393d65eaea45caab6cbf292ad9bd4a4a0a3fabc01ed7d216e63dcbd02b79/pyconomic-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "24876970bee2bb1da37670a8eb8f366e", "sha256": "aa08a2ffac13be23c3894797b82baa5a30539bad1517070d9931d75ba3263247" }, "downloads": -1, "filename": "pyconomic-0.1.2.tar.gz", "has_sig": false, "md5_digest": "24876970bee2bb1da37670a8eb8f366e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14961, "upload_time": "2013-08-01T22:15:19", "url": "https://files.pythonhosted.org/packages/78/05/970ae44373ed477e357a2d33adc0c5749dc572870afdae8f18c799e52fd6/pyconomic-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "24876970bee2bb1da37670a8eb8f366e", "sha256": "aa08a2ffac13be23c3894797b82baa5a30539bad1517070d9931d75ba3263247" }, "downloads": -1, "filename": "pyconomic-0.1.2.tar.gz", "has_sig": false, "md5_digest": "24876970bee2bb1da37670a8eb8f366e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14961, "upload_time": "2013-08-01T22:15:19", "url": "https://files.pythonhosted.org/packages/78/05/970ae44373ed477e357a2d33adc0c5749dc572870afdae8f18c799e52fd6/pyconomic-0.1.2.tar.gz" } ] }