{ "info": { "author": "Giacomo Lacava", "author_email": "giac@autoepm.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: Session", "Topic :: Office/Business :: Financial", "Topic :: Office/Business :: Financial :: Accounting" ], "description": "# Django-Xero\n[Xero](https://xero.com) integration for Django.\n\n## Features\nThis package allows users to authenticate to Xero via a Public App that you have \nregistered on the [Xero Developer Portal](https://developer.xero.com).\n\nWhenever you want to trigger authentication with Xero, just redirect to the view \n`xero_auth_start` (either directly or via `resolve('xero-auth-start')` and this package \nwill do the rest. \nThe view also accepts an optional `next`parameter to control where the user will land \non successful authentication; otherwise it will redirect to `/`.\n\nXero sessions last for 30 minutes, but if you want to end them earlier, POST to \nthe view `xero_logout` (again with an optional `next`).\n\nThere is also a `@xero_required` decorator for views, which will automatically \ncheck if an active Xero session is present. If not, it will redirect to an interstitial page\nasking the user to do the authentication dance. You can control that page by creating a \ncustom template `xero/interstitial.html` (make sure it has a link to `xero-auth-start` somewhere). \n\nOnce authorized, in your view you will get a `.xerouser` attribute which you can use to do stuff like:\n```python\n\nfrom djxero.decorators import xero_required\n\n@login_required\n@xero_required\ndef my_view(request):\n client = request.user.xerouser.client\n contacts = client.contacts.all()\n ...\n``` \nThat client is a preconfigured `xero.Xero` object from [pyxero](https://github.com/freakboy3742/pyxero).\n\nSome details will be exposed in `User` instances under `.xerouser`, but the Xero mechanisms\nare such that it's all pretty meaningless - there is currently no way to know anything about the user \nfrom the xero session alone. For that reason, note that \n***you must have some other registration mechanism to create a regular Django\n user first*** (e.g. regular login page with some other auth system); this package only extends \nthat `User` instance to attach a temporary Xero session.\n\nIf your User model has the same email or firstname/lastname as recorded in Xero,\nyou can try to guess its details with `request.user.xerouser.guess_user()` and then manually save the ID\nin `request.user.xerouser.xero_id`, but the heuristic is very basic and may or may not work.\n\n## Supported Platforms\n* Python 3.7 (should work on 3.5/3.6 too, but is untested).\n* Django 2\n\n## Requirements\ndjango-xero should automatically download all necessary prerequisites, but I like\nto give credit where credit is due. \nWe stand on the shoulders of the following giants:\n\n* [django-encrypted-model-fields](https://gitlab.com/lansharkconsulting/django/django-encrypted-model-fields/)\n* [pyxero](https://github.com/freakboy3742/pyxero)\n\n## Installation\n1. Install the package\n ```\n pip install django-xero\n ```\n2. Add `encrypted_model_fields` and `djxero` to `INSTALLED_APPS` in your settings. \n Note that the authentication system is required.\n ```python\n INSTALLED_APPS = [\n 'django.contrib.auth',\n 'django.contrib.sessions',\n ...\n 'encrypted_model_fields',\n 'djxero',\n ...\n ]\n ```\n3. Generate an encryption key:\n ```bash\n python -c 'import base64; import os; print(base64.urlsafe_b64encode(os.urandom(32)))'\n ```\n and add it to your settings. NOTE: in production, you want to store this safely.\n ```python\n FIELD_ENCRYPTION_KEY = b'A7c4T1Kx3XmttUjm2cX8ScYcUEdF7RzFziEzfoBO7x4='\n ```\n4. Run migrations to create the necessary objects\n ```bash\n python manage.py migrate djxero\n ```\n5. Set the Xero secrets for your public app. You can do this from the admin site (easier),\n or directly via `manage.py shell`:\n ```python\n from djxero.models import XeroSecret\n consumer_key = XeroSecret.objects.get(pk='xero_consumer_key')\n consumer_key.value = 'your key'\n consumer_key.save()\n consumer_secret = XeroSecret.objects.get(pk='xero_consumer_secret')\n consumer_secret.value = 'your secret'\n consumer_secret.save()\n ```\n6. in your project `urls.py`, add the following:\n ```python\n urlpatterns = [\n path('xero/', include('djxero.urls')),\n ...\n ]\n ```\n\n\n ## Issues\n For problems, file an issue on [GitHub](https://github.com/toyg/django-xero).\n The author is available for hire (hint hint).\n\n ## Credits and License\n Copyright (c) 2019 [Giacomo Lacava](https://linkedin.com/in/glacava).\n\n Released under the terms of the Apache Software License, version 2.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/toyg/django-xero", "keywords": "", "license": "Apache Software License v.2", "maintainer": "", "maintainer_email": "", "name": "django-xero", "package_url": "https://pypi.org/project/django-xero/", "platform": "", "project_url": "https://pypi.org/project/django-xero/", "project_urls": { "Homepage": "https://github.com/toyg/django-xero" }, "release_url": "https://pypi.org/project/django-xero/0.0.3/", "requires_dist": [ "Django (<3.0,>=2.2.3)", "cryptography (<3.0,>=2.7)", "django-encrypted-model-fields (<0.6,>=0.5.8)", "pyxero (<1.0,>=0.9.1)" ], "requires_python": "", "summary": "Xero integration for Django", "version": "0.0.3" }, "last_serial": 5532001, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4f90e64f744ae0cd03c5a7bcf6a38133", "sha256": "c99f09da045ab8c6ff2f2a57bee7d6c4f5db1140e4b2f61d4ca3442b50557398" }, "downloads": -1, "filename": "django_xero-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4f90e64f744ae0cd03c5a7bcf6a38133", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16433, "upload_time": "2019-07-10T15:05:12", "url": "https://files.pythonhosted.org/packages/8f/b0/990f21d02fcda6c03a8c470a681bc443a21fe74d42f5c6b197eb3ce70239/django_xero-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a203113c4912230a6ce374cd857c8b5c", "sha256": "74c0b404787309a7aae42e6dd61e58af741556be4f808e215415f9ed06d61a73" }, "downloads": -1, "filename": "django-xero-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a203113c4912230a6ce374cd857c8b5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11981, "upload_time": "2019-07-10T15:05:14", "url": "https://files.pythonhosted.org/packages/0a/ff/f04498ec573eb6b1c66bc989cdff6a3e03417ef5ccb59b00d8b20af197b4/django-xero-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "cf2a5e670d0e1315eccdcb166a39ad00", "sha256": "c8f7e51f8dfdccd099aa7d0920b5cf8d3ccf0ed8e3c7ec4fea49b1e7bd46d94d" }, "downloads": -1, "filename": "django_xero-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cf2a5e670d0e1315eccdcb166a39ad00", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16528, "upload_time": "2019-07-10T17:38:34", "url": "https://files.pythonhosted.org/packages/a3/dd/d4cc3b9a0547f0eb506d6f426a61cba77f1f85a776915433c013fe7b2215/django_xero-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "57b2d76dbad7b612e76bd3ac6ed470b3", "sha256": "06dd4e79996005c3b787bd9ae0508467b3d0bdf105d87da75c6aae5f22541fff" }, "downloads": -1, "filename": "django-xero-0.0.2.tar.gz", "has_sig": false, "md5_digest": "57b2d76dbad7b612e76bd3ac6ed470b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12076, "upload_time": "2019-07-10T17:38:37", "url": "https://files.pythonhosted.org/packages/1a/94/04ca9d961c1093092e0b43ee6151502941b4fe3a30a6be8dc13090ccca8d/django-xero-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "2f50758f5f77d81346ec057892a03ced", "sha256": "9f9bc446c430c720b4a153bc7e52ab8ef4f889260f091c61fae41657d7a1fbbd" }, "downloads": -1, "filename": "django_xero-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f50758f5f77d81346ec057892a03ced", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17335, "upload_time": "2019-07-14T20:45:06", "url": "https://files.pythonhosted.org/packages/17/36/3b4cbb47d5d4ff4a29985f7e9b83a0c34632f6ac66402358944735959303/django_xero-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ad05fe83dacb3a1e4b78e4f0f47787ca", "sha256": "ac6d912e8773f61500dd4f4a08635c53a13e5b72a84f15171be4b9ca7637e5ad" }, "downloads": -1, "filename": "django-xero-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ad05fe83dacb3a1e4b78e4f0f47787ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6782467, "upload_time": "2019-07-14T20:45:13", "url": "https://files.pythonhosted.org/packages/1d/7f/2f4f8c2c73bb50614185e38131c46f53c5b0129339f5b1127b05713e85ba/django-xero-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2f50758f5f77d81346ec057892a03ced", "sha256": "9f9bc446c430c720b4a153bc7e52ab8ef4f889260f091c61fae41657d7a1fbbd" }, "downloads": -1, "filename": "django_xero-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f50758f5f77d81346ec057892a03ced", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17335, "upload_time": "2019-07-14T20:45:06", "url": "https://files.pythonhosted.org/packages/17/36/3b4cbb47d5d4ff4a29985f7e9b83a0c34632f6ac66402358944735959303/django_xero-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ad05fe83dacb3a1e4b78e4f0f47787ca", "sha256": "ac6d912e8773f61500dd4f4a08635c53a13e5b72a84f15171be4b9ca7637e5ad" }, "downloads": -1, "filename": "django-xero-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ad05fe83dacb3a1e4b78e4f0f47787ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6782467, "upload_time": "2019-07-14T20:45:13", "url": "https://files.pythonhosted.org/packages/1d/7f/2f4f8c2c73bb50614185e38131c46f53c5b0129339f5b1127b05713e85ba/django-xero-0.0.3.tar.gz" } ] }