{ "info": { "author": "Brett Haydon", "author_email": "brett@haydon.id.au", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "===============================\nAuth0+ python\n===============================\n\n\n.. image:: https://img.shields.io/pypi/v/auth0plus.svg\n :target: https://pypi.python.org/pypi/auth0plus\n\n.. image:: https://img.shields.io/travis/bretth/auth0plus.svg\n :target: https://travis-ci.org/bretth/auth0plus\n\n.. image:: https://coveralls.io/repos/github/bretth/auth0plus/badge.svg?branch=master :target: https://coveralls.io/github/bretth/auth0plus?branch=master\n\n\nAn unofficial python interface for the Auth0 management api v2 that speeds up integration in python projects.\n\n* Free software: ISC license\n\n\nInstallation\n------------\n::\n\n $ pip install auth0plus\n\nUsage\n------\n\nWe'll get started with the simplest scenario which is using Auth0 to store a database of users to authenticate against. For this you need to configure a domain and a non-interactive client to access a connection (database). You will also need a JSON web token (jwt) for the client application to access the parts of the api you specify (scopes). This can be generated manually or as I will show here it can be programmatically granted every 24 hours by a separate call to an oauth/token endpoint:\n\n- Login to auth0.com\n- Go to the `clients menu `_\n- Create a client and click on it's settings to get the *Domain* *Client ID* and *Client Secret*\n- Go to the `APIs menu `_ and click *Auth0 Management API*\n- Click *Non Interactive Clients* and authorise your client then expand the selection to select scopes.\n- Select read:users, update:users, delete:users, create:users, read:users_app_metadata, update:users_app_metadata, delete:users_app_metadata, create:users_app_metadata and create:user_tickets then *update*.\n\nFor more information on the above process read ``_.\n\nIn your code import the Auth0 class.\n::\n >>> from auth0plus.management import Auth0\n >>> from auth0plus.oauth import get_token\n\nThis example doctest uses python-dotenv to hold the secrets and variables in a .env file. You can configure and run it your self with **make doctests**.\n::\n >>> import os\n >>> from dotenv import load_dotenv\n >>> load_dotenv('.env')\n True\n >>> domain = os.getenv('DOMAIN')\n >>> client_id = os.getenv('CLIENT_ID')\n >>> client_secret = os.getenv('CLIENT_SECRET')\n >>> db = os.getenv('CONNECTION')\n\nGet the 24 hour jwt token dictionary which you would normally store somewhere::\n\n >>> token = get_token(domain, client_id, client_secret)\n\nCreate the lazy connection. We're going to connect to a database backed store.\n::\n >>> auth0 = Auth0(domain, token['access_token'], client_id=client_id, default_connection=db)\n\nThe api follows the documented api for v2. So the endpoint of /api/v2/users is going to be *auth0.users*, and to get an empty user instance you would call the constructor.\n::\n >>> user = auth0.users()\n\nNow we'll actually create a few users for my 4 year old's favourite band:\n\n1. In one step using the endpoint *create* method.\n::\n >>> angus = auth0.users.create(email='angus.young@acdc.com', email_verified=True,\n ... password='Jailbreak', user_metadata={'family_name': 'Young'})\n\n2. With the convience *get_or_create* method which follows the django equivalent.\n::\n >>> malcolm, created = auth0.users.get_or_create(\n ... defaults={'email_verified': True, 'password': 'ChuckB',\n ... 'user_metadata': {'family_name': 'Young'}}, email='malcolm.young@acdc.com')\n >>> malcolm.user_metadata\n {'family_name': 'Young'}\n >>> malcolm.picture\n 'https://s.gravatar.com/avatar/...'\n\n3. In two steps with init and *save*.\n::\n >>> singer = auth0.users(email='dave.evans@acdc.com', email_verified=True,\n ... password='CanISitNextToYouGirl')\n >>> singer.save()\n >>> print(singer.user_id)\n auth0|...\n\n*Save* also updates the user (which may need to make multiple calls to the endpoint).\n::\n >>> singer.email = 'bon.scott@acdc.com'\n >>> singer.password = 'HighwayToHell'\n >>> singer.save()\n\nOne thing to note is that the password is not available once it's saved.\n::\n >>> singer.password\n Traceback (most recent call last):\n File \"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/doctest.py\", line 1320, in __run\n compileflags, 1), test.globs)\n File \"\", line 1, in \n singer.password\n File \".../auth0plus/auth0plus/management/users.py\", line 118, in password\n raise AttributeError(\"'User' object does not have a new password\")\n AttributeError: 'User' object does not have a new password\n\nTo distinguish between a User instance that has been created locally and one that has been fetched from Auth0 the boolean attribute *_fetched* determines whether saving the record would be an update (*True*) or a create (*False*).\n\nThe *get* classmethod allows returning a single instance, and class specific *ObjectDoesNotExist* exception (*User.DoesNotExist*) if it doesn't exist.\n::\n >>> try:\n ... brian = auth0.users.get(email='brian.johnson@acdc.com')\n ... except auth0.users.DoesNotExist as err:\n ... print(err)\n User Does Not Exist\n\n >>> brian, created = auth0.users.get_or_create(\n ... defaults={'email_verified': True, 'password': 'BackInBlack'},\n ... email='brian.johnson@acdc.com')\n\n\nThe *get* method uses the auth0 lucene search which means for anything other than the id you can potentially get multiple results (and a *MultipleObjectsReturned* exception), but beware you also need to ensure enough time has passed for newly created users to be indexed.\n::\n >>> from auth0plus.exceptions import MultipleObjectsReturned\n >>> import time\n >>> time.sleep(5)\n >>> try:\n ... singers = auth0.users.get(email='b*')\n ... except MultipleObjectsReturned as err:\n ... print(err)\n User.get returned multiple users\n\nWhen you actually want multiple results use a *query* or *all* which return a sliceable lazy object.\n::\n >>> singers = auth0.users.query(email='b*')\n >>> singers.count() # the total returned by include_totals=true, no iteration necessary\n 2\n >>> singers[:] # evaluate the whole query\n [, ]\n\nYou can also construct your own 'q' syntax instead of keyword arguments and pass additional endpoint parameters. In this case we'll just get the user_id and email.\n::\n >>> brothers = auth0.users.query(\n ... q='user_metadata.family_name:\"Young\"',\n ... fields='user_id,email')\n >>> brothers.count()\n 2\n\nIf you want to do something with the user data returned then *as_dict* is your friend.\n::\n >>> serialized = brothers[0].as_dict()\n\nTo maintain state such as whether it has been *_fetched* from auth0 you would pickle the instance, otherwise *as_dict* is the safer choice to reconstitute the object making no assumptions about any changes that might have been made.\n::\n >>> new_angus = auth0.users(**serialized)\n >>> new_angus.password = 'MoneyTrain'\n >>> from auth0plus.exceptions import Auth0Error\n >>> try:\n ... new_angus.save()\n ... except Auth0Error as err:\n ... print(err)\n 400: The user already exists.\n\nDelete instances with classmethods or instance method.\n::\n >>> singer.delete() # Remove Bon Scott\n >>> auth0.users.delete(brian.get_id())\n\nGet all the remaining band members (and delete them). Sorry Angus, it's time to retire.\n::\n >>> band = auth0.users.all()\n >>> band.count()\n 2\n >>> for member in band:\n ... member.delete()\n\n\nCredits\n---------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.3.0 (09-May-2017)\n--------------------\n\n* Add get_token function to work with the new temporary client tokens\n\n0.2.4 (20-June-2016)\n--------------------\n\n* Fix issue with pickling\n* Fix issue with shared nested dictionary\n\n0.2.3 (10-May-2016)\n-------------------\n\n* And so does unicode\n\n0.2.2 (10-May-2016)\n-------------------\n\n* Setuptools always catches me out\n\n0.2.1 (05-May-2016)\n-------------------\n\n* Fix issue with get and save flow\n\n0.2.0 (04-May-2016)\n-------------------\n\n* Package as wheel\n* Import auth0 from auth0plus.management\n\n0.1.0 (01-May-2016)\n-------------------\n\n* First release on PyPI.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bretth/auth0plus", "keywords": "auth0plus", "license": "ISCL", "maintainer": "", "maintainer_email": "", "name": "auth0plus", "package_url": "https://pypi.org/project/auth0plus/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/auth0plus/", "project_urls": { "Homepage": "https://github.com/bretth/auth0plus" }, "release_url": "https://pypi.org/project/auth0plus/0.3.0/", "requires_dist": [ "combomethod", "requests" ], "requires_python": "", "summary": "Unofficial enhancements to the Auth0-python package", "version": "0.3.0" }, "last_serial": 2860516, "releases": { "0.1.0": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ad554222ada488c55052c12fe10b9160", "sha256": "1382aa56352e740871ee60f4340f21f9fec2637a409d20bced9361c708ac42aa" }, "downloads": -1, "filename": "auth0plus-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad554222ada488c55052c12fe10b9160", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 8119, "upload_time": "2016-05-05T05:32:43", "url": "https://files.pythonhosted.org/packages/75/9a/56b40abca4fbd4df7f4b72e4886d7926cf3b1d9b0e63c12b1dea2bfc5638/auth0plus-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87093fdd18c113f1462a0e426c4e506a", "sha256": "6ec0058a84e7cc2f0517fd1764d4a9e91711fe05c87dccc0ca6fb58b07327689" }, "downloads": -1, "filename": "auth0plus-0.2.0.tar.gz", "has_sig": false, "md5_digest": "87093fdd18c113f1462a0e426c4e506a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13137, "upload_time": "2016-05-05T05:32:35", "url": "https://files.pythonhosted.org/packages/14/64/13eddc5039af05fcbfd87c684f1c4cce36f8f9f5dbedc3419c8fead3fb1d/auth0plus-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "2cb2e1fc7205036bcdc36edc0b84f969", "sha256": "c18f27fedd4d4c1d67f556e75faec2907b2019b8c57b776e6bead9bd3b69b9cf" }, "downloads": -1, "filename": "auth0plus-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2cb2e1fc7205036bcdc36edc0b84f969", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 8172, "upload_time": "2016-05-05T06:19:05", "url": "https://files.pythonhosted.org/packages/cb/ba/27e0e7f981c5e1499a3b42a23eb90c8469801b03da05af2669a3774c2eb9/auth0plus-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "513c93154d498ddf128434f766fc81f4", "sha256": "943b7baae989779e2d7ae6be374a4ba165120a5bc24ec40e0a2c890a1ced7d6a" }, "downloads": -1, "filename": "auth0plus-0.2.1.tar.gz", "has_sig": false, "md5_digest": "513c93154d498ddf128434f766fc81f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13158, "upload_time": "2016-05-05T06:18:56", "url": "https://files.pythonhosted.org/packages/fe/e9/d50625fecc8ed09d77395e1c19297bb41c5e058a2158e2e2d0d724c4746f/auth0plus-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "fb1661fe961ca70c920ab5956c8ee70f", "sha256": "7568aa7192c1d3e6d26980699fe7207dd0fcb918a67e6f36ac8d587827156e31" }, "downloads": -1, "filename": "auth0plus-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fb1661fe961ca70c920ab5956c8ee70f", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 15674, "upload_time": "2016-05-10T02:37:14", "url": "https://files.pythonhosted.org/packages/e6/5e/8d1b27cd0695c065b547801bc900f507212e7e7aab91dd4553b1237e6cf4/auth0plus-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7422216d0b0002f48a1de68d06b455af", "sha256": "e649315a071dd56391911c9f23ede93096e551221d7b5c50a07e3bc7a394e1ab" }, "downloads": -1, "filename": "auth0plus-0.2.2.tar.gz", "has_sig": false, "md5_digest": "7422216d0b0002f48a1de68d06b455af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18496, "upload_time": "2016-05-10T02:36:50", "url": "https://files.pythonhosted.org/packages/e3/f0/4f9e39ddc65d2995afd811da928e29d27406e682a66011dd15195becb7da/auth0plus-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "5dab08e0805c25363e94e8b6b7e6f341", "sha256": "0a588bad0a89b63e2423e34184a8037e8ea2a6f9460d95a55f7a1978a3f27be3" }, "downloads": -1, "filename": "auth0plus-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5dab08e0805c25363e94e8b6b7e6f341", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 15705, "upload_time": "2016-05-10T04:11:33", "url": "https://files.pythonhosted.org/packages/b6/b5/46a347cf3557967876438edc9d3c5bb0e1e8d4ba78132af7fdb425636b07/auth0plus-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "277142017171ea625419d5897028e6fc", "sha256": "277c34988be75be2d0383bc3c186259bffccfb7e8819ced309e8832c63bcdf3a" }, "downloads": -1, "filename": "auth0plus-0.2.3.tar.gz", "has_sig": false, "md5_digest": "277142017171ea625419d5897028e6fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18535, "upload_time": "2016-05-10T04:11:26", "url": "https://files.pythonhosted.org/packages/a4/02/55bfd45a71a5a3753954a3d1f4d94e1c4125b7e0922cea6bb80db56a3008/auth0plus-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "c859d548c5990a025d625a803d644cff", "sha256": "9145b9ea651c75708d0a6a7649f16d8da432f4e69ef3a9bfe3228a8c1176b8a3" }, "downloads": -1, "filename": "auth0plus-0.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c859d548c5990a025d625a803d644cff", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 16288, "upload_time": "2016-06-19T21:11:25", "url": "https://files.pythonhosted.org/packages/b2/41/c41b28bdc59127aa005b2837c41e0cc4680dc8138fa05f0a7a3a6c3d519c/auth0plus-0.2.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fb08979ebc08aec3a4e113967b10df94", "sha256": "735871de47752a48149a523f71503b6c0d962697e4df37fd9b4b260c41d86fdb" }, "downloads": -1, "filename": "auth0plus-0.2.4.tar.gz", "has_sig": false, "md5_digest": "fb08979ebc08aec3a4e113967b10df94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18845, "upload_time": "2016-06-19T21:11:17", "url": "https://files.pythonhosted.org/packages/2e/b6/9588ed96ec699b5dd1ae9ad38553e1f43b6c3001533ad1f85b04cd2402f2/auth0plus-0.2.4.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "90d93219f33e233bcf5d99c616ec27cc", "sha256": "0128dff0b4eee6f7cab6491e520118c4a9a841337b479c44321f1bfa352263d4" }, "downloads": -1, "filename": "auth0plus-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "90d93219f33e233bcf5d99c616ec27cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17461, "upload_time": "2017-05-09T01:42:24", "url": "https://files.pythonhosted.org/packages/e7/c3/c721d083e8251c1cf286779059835cd930cd78a95f8dd48da7187f78421f/auth0plus-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cfcdaae32d2611d53eb4b501507d7f3", "sha256": "6c85a081b159238e0db8a55aaa15a5c328bc71f6a5e23a2f36d34478d13fd1f9" }, "downloads": -1, "filename": "auth0plus-0.3.0.tar.gz", "has_sig": false, "md5_digest": "1cfcdaae32d2611d53eb4b501507d7f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21821, "upload_time": "2017-05-09T01:42:26", "url": "https://files.pythonhosted.org/packages/e6/81/a063df45b9d2817306cd310197e060fcee7f766839adfb3b1ba4647f7ad9/auth0plus-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "90d93219f33e233bcf5d99c616ec27cc", "sha256": "0128dff0b4eee6f7cab6491e520118c4a9a841337b479c44321f1bfa352263d4" }, "downloads": -1, "filename": "auth0plus-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "90d93219f33e233bcf5d99c616ec27cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17461, "upload_time": "2017-05-09T01:42:24", "url": "https://files.pythonhosted.org/packages/e7/c3/c721d083e8251c1cf286779059835cd930cd78a95f8dd48da7187f78421f/auth0plus-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cfcdaae32d2611d53eb4b501507d7f3", "sha256": "6c85a081b159238e0db8a55aaa15a5c328bc71f6a5e23a2f36d34478d13fd1f9" }, "downloads": -1, "filename": "auth0plus-0.3.0.tar.gz", "has_sig": false, "md5_digest": "1cfcdaae32d2611d53eb4b501507d7f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21821, "upload_time": "2017-05-09T01:42:26", "url": "https://files.pythonhosted.org/packages/e6/81/a063df45b9d2817306cd310197e060fcee7f766839adfb3b1ba4647f7ad9/auth0plus-0.3.0.tar.gz" } ] }