{ "info": { "author": "Thierry Jossermoz", "author_email": "thierry.jossermoz@oohlalabs.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": ".. note::\r\n\r\n For the latest source, discussions, etc., please visit the\r\n `GitHub repository `_\r\n\r\n\r\n=======\r\nUniAuth\r\n=======\r\n\r\n.. image:: https://travis-ci.org/jthi3rry/uniauth.svg?branch=master\r\n :target: https://travis-ci.org/jthi3rry/uniauth\r\n\r\n.. image:: https://coveralls.io/repos/jthi3rry/uniauth/badge.png?branch=master\r\n :target: https://coveralls.io/r/jthi3rry/uniauth\r\n\r\nMinimalist and framework independent package that provides common OAuth (1 & 2) consumers (or the ability to easily add more).\r\n\r\n* Unifies OAuth1 and OAuth2 flows into one easy and clear dance\r\n* Normalises providers' profiles data\r\n* Normalises OAuth1 & 2 tokens for storage/restoration\r\n* Based on `oauthlib `_ and `requests `_\r\n\r\nInstallation\r\n============\r\n\r\n::\r\n\r\n pip install uniauth\r\n\r\nUsage\r\n=====\r\n\r\nRetrieve a token::\r\n\r\n from uniauth import Bitbucket, GitHub\r\n\r\n # Use an OAuth2 client\r\n client = GitHub(client_id=\"****************\", client_secret=\"****************\", scope=None)\r\n\r\n # Or an OAuth1 client\r\n client = Bitbucket(client_id=\"****************\", client_secret=\"****************\")\r\n\r\n # Provides a unified flow for both OAuth1 & OAuth2\r\n oauth_dance = client.dance(stash, \"http://example.org/oauth/callback\")\r\n\r\n # 'stash' allows to complete the oauth dance over multiple requests (by maintaining OAuth1's request token or OAuth2's state)\r\n # It can be anything as long as it implements __setattr__(key, value) and pop(key, default)\r\n # e.g.:\r\n # stash = request.session\r\n # Or\r\n # stash = {}\r\n\r\n # Redirect your user to:\r\n oauth_dance.get_authorization_url()\r\n\r\n # Get the access token using the absolute url the povider redirected your user to:\r\n normalised_token = oauth_dance.get_access_token(callback_url)\r\n # {\"token\": \"**********\", \"extra\": \"**********\", \"expires_at\": None, \"scope\": None}\r\n\r\n # The token is also stored in the client state\r\n client.get_profile()\r\n\r\nRestore a token::\r\n\r\n # OAuth2 client\r\n client = GitHub(client_id=\"****************\", client_secret=\"****************\", scope=None, token=normalised_token)\r\n\r\n # or OAuth1 client\r\n client = Bitbucket(client_id=\"****************\", client_secret=\"****************\", token=normalised_token)\r\n\r\n client.get_profile()\r\n\r\nRequest any resource::\r\n\r\n # client.request has a similar signature to requests.request but with an optional method (it uses \"GET\" by default)\r\n response = client.request(url_to_resource)\r\n\r\n # response is an instance of requests.Response\r\n response.raise_for_status()\r\n\r\n data = response.json()\r\n\r\n\r\nThat's it.\r\n\r\nAvailable Consumers\r\n===================\r\n\r\nBitbucket\r\n---------\r\n\r\nUse ``uniauth.Bitbucket``\r\n\r\nFacebook\r\n--------\r\n\r\nUse ``uniauth.Facebook``\r\n\r\nGitHub\r\n------\r\n\r\nUse ``uniauth.GitHub``\r\n\r\nGoogle\r\n------\r\n\r\nUse ``uniauth.Google``\r\n\r\nLinkedIn\r\n--------\r\n\r\nUse ``uniauth.LinkedIn``\r\n\r\nContribute More\r\n---------------\r\n\r\nIt's easy to add more consumers::\r\n\r\n from uniauth.base import ProfileMixin\r\n from uniauth.oauth2 import OAuth2Consumer\r\n\r\n class MyProviderName(ProfileMixin, OAuth2Consumer):\r\n authorization_url = \"https://example.org/oauth2/authorization\"\r\n access_token_url = \"https://example.org/oauth2/access_token\"\r\n profile_url = \"https://example.org/user/\"\r\n\r\n def normalize_profile_data(self, data):\r\n # transform provider's format into normalised format\r\n return {\"uid\": data.get(\"id\"),\r\n \"email\": data.get(\"email_address\"),\r\n \"username\": data.get(\"login\"),\r\n \"first_name\": data.get(\"given_name\"),\r\n \"last_name\": data.get(\"family_name\"),\r\n \"gender\": data.get(\"sex\"),\r\n \"birthdate\": data.get(\"dob\"),\r\n \"avatar_url\": data.get(\"picture\"),\r\n \"is_verified\": data.get(\"verified\")}\r\n\r\n\r\nRunning Tests\r\n=============\r\n\r\nGet a copy of the repository::\r\n\r\n git clone git@github.com:OohlaLabs/uniauth.git .\r\n\r\nInstall `tox `_::\r\n\r\n pip install tox\r\n\r\nRun the tests::\r\n\r\n tox\r\n\r\nContributions\r\n=============\r\n\r\nAll contributions and comments are welcome.\r\n\r\nChange Log\r\n==========\r\n\r\nv0.0.2\r\n------\r\n* Cast default provider name to unicode\r\n* Fix resource request extra params not used\r\n\r\nv0.0.1\r\n------\r\n* Initial", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/OohlaLabs/uniauth", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "uniauth", "package_url": "https://pypi.org/project/uniauth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/uniauth/", "project_urls": { "Homepage": "https://github.com/OohlaLabs/uniauth" }, "release_url": "https://pypi.org/project/uniauth/0.0.2/", "requires_dist": [ "oauthlib (>=0.7.2)", "requests (>=2.5.1)", "pytz (>=2014.10)", "six (>=1.9.0)", "python-dateutil (>=2.4.2)" ], "requires_python": null, "summary": "Minimalist and framework independent OAuth(1 & 2) consumers", "version": "0.0.2" }, "last_serial": 1601473, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "dfb68fe2c0ef462280d2afd0726d0187", "sha256": "4cce6b00ef36bc7213d37b56bf2a7ad6d70bde87237f709ff8b127819bbee982" }, "downloads": -1, "filename": "uniauth-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dfb68fe2c0ef462280d2afd0726d0187", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11671, "upload_time": "2015-05-03T04:12:19", "url": "https://files.pythonhosted.org/packages/cd/97/9f43e1f06c2630da39b1c77390dda1df44357ca0349875ab581e1fd241bd/uniauth-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "303ce0db9013bc6dc23a8a09d96da7d2", "sha256": "44cec7e8b863ba42efa145f3b2208d3f65cfef181209fe48a761677fdddf8572" }, "downloads": -1, "filename": "uniauth-0.0.1.tar.gz", "has_sig": false, "md5_digest": "303ce0db9013bc6dc23a8a09d96da7d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9982, "upload_time": "2015-05-03T04:12:23", "url": "https://files.pythonhosted.org/packages/df/01/512a3d19f073e9c91538996e3b5f283898dd12b806444b85df9de7d0684c/uniauth-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f08f82f1e8c2afd0fb1b0da61d2194d7", "sha256": "03d0e4b4edbcdffda8440f3a0d98b2dac9427ebf6d82d89752a0be3444d3c499" }, "downloads": -1, "filename": "uniauth-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f08f82f1e8c2afd0fb1b0da61d2194d7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11770, "upload_time": "2015-06-22T05:15:44", "url": "https://files.pythonhosted.org/packages/2a/69/713067ed2aa8bead14f1232945ebec39dd65ce1e6d37fddd30f1c6c19194/uniauth-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "10991f76fdbe24abc6161f0553a5b788", "sha256": "97b48e089c7f9f16ccac8048ae504e26b9b72fd38890982efcbcbe73eac229ac" }, "downloads": -1, "filename": "uniauth-0.0.2.tar.gz", "has_sig": false, "md5_digest": "10991f76fdbe24abc6161f0553a5b788", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10106, "upload_time": "2015-06-22T05:15:48", "url": "https://files.pythonhosted.org/packages/49/6c/e9bcd03e29707a119557bccc835db540756c4858fe0ddd7e3272d1dc9992/uniauth-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f08f82f1e8c2afd0fb1b0da61d2194d7", "sha256": "03d0e4b4edbcdffda8440f3a0d98b2dac9427ebf6d82d89752a0be3444d3c499" }, "downloads": -1, "filename": "uniauth-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f08f82f1e8c2afd0fb1b0da61d2194d7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11770, "upload_time": "2015-06-22T05:15:44", "url": "https://files.pythonhosted.org/packages/2a/69/713067ed2aa8bead14f1232945ebec39dd65ce1e6d37fddd30f1c6c19194/uniauth-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "10991f76fdbe24abc6161f0553a5b788", "sha256": "97b48e089c7f9f16ccac8048ae504e26b9b72fd38890982efcbcbe73eac229ac" }, "downloads": -1, "filename": "uniauth-0.0.2.tar.gz", "has_sig": false, "md5_digest": "10991f76fdbe24abc6161f0553a5b788", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10106, "upload_time": "2015-06-22T05:15:48", "url": "https://files.pythonhosted.org/packages/49/6c/e9bcd03e29707a119557bccc835db540756c4858fe0ddd7e3272d1dc9992/uniauth-0.0.2.tar.gz" } ] }