{ "info": { "author": "Oregon Center for Applied Science", "author_email": "bpitcher@orcasinc.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-tastypie-oauth\n=====================\n\n[![Build Status](https://travis-ci.org/orcasgit/django-tastypie-oauth.svg?branch=master)](https://travis-ci.org/orcasgit/django-tastypie-oauth) [![Coverage Status](https://coveralls.io/repos/orcasgit/django-tastypie-oauth/badge.png?branch=master)](https://coveralls.io/r/orcasgit/django-tastypie-oauth?branch=master) [![Requirements Status](https://requires.io/github/orcasgit/django-tastypie-oauth/requirements.png?branch=master)](https://requires.io/github/orcasgit/django-tastypie-oauth/requirements/?branch=master)\n\nProviding OAuth services for Tastypie APIs\n\nDependencies\n============\nThis library works with two different OAuth providers, you must install one of them:\n- django-oauth-toolkit: https://github.com/evonove/django-oauth-toolkit\n- django-oauth2-provider: https://github.com/caffeinehit/django-oauth2-provider\n\nSet up one of these libraries before continuing\n\nUsage\n=====\n\n1. Add `tastypie_oauth` to `INSTALLED_APPS` in Django.\n2. Specify `OAUTH_ACCESS_TOKEN_MODEL` in the Django settings. At this time it can be `'oauth2_provider.models.AccessToken'` for django-oauth-toolkit and `'provider.oauth2.models.AccessToken'` for django-oauth2-provider.\n3. When you create your Tastypie resources, use `OAuth20Authentication` like so:\n\n ```python\n # mysite/polls/api.py\n from tastypie.resources import ModelResource\n from tastypie.authorization import DjangoAuthorization\n from polls.models import Poll, Choice\n from tastypie import fields\n from tastypie_oauth.authentication import OAuth20Authentication\n\n class ChoiceResource(ModelResource):\n class Meta:\n queryset = Choice.objects.all()\n resource_name = 'choice'\n authorization = DjangoAuthorization()\n authentication = OAuth20Authentication()\n\n class PollResource(ModelResource):\n choices = fields.ToManyField(ChoiceResource, 'choice_set', full=True)\n class Meta:\n queryset = Poll.objects.all()\n resource_name = 'poll'\n authorization = DjangoAuthorization()\n authentication = OAuth20Authentication()\n ```\n Or, if you want to use scoped authentication, use the `OAuth2ScopedAuthentication` class:\n ```python\n from tastypie_oauth.authentication import OAuth20ScopedAuthentication\n\n # With Django-oauth-toolkit\n class ChoiceResource(ModelResource):\n poll = fields.ToOneField(\"polls.api.PollResource\", \"poll\", full=False)\n class Meta:\n resource_name = 'choice'\n queryset = Choice.objects.all()\n authorization = DjangoAuthorization()\n authentication = OAuth2ScopedAuthentication(\n post=(\"read write\",),\n get=(\"read\",),\n put=(\"read\",\"write\")\n )\n ```\n ```python\n from provider.constants import READ, WRITE, READ_WRITE\n from tastypie_oauth.authentication import OAuth20ScopedAuthentication\n\n # With Django-oauth2-provider\n class ChoiceResource(ModelResource):\n poll = fields.ToOneField(\"polls.api.PollResource\", \"poll\", full=False)\n class Meta:\n resource_name = 'choice'\n queryset = Choice.objects.all()\n authorization = DjangoAuthorization()\n authentication = OAuth2ScopedAuthentication(\n post=(READ_WRITE,),\n get=(READ,),\n put=(READ,WRITE)\n )\n ```\n4. After authorizing the user and gaining an access token, you can use the API almost as before with just one minor change. You must add a `oauth_consumer_key` GET or POST parameter with the access token as the value, or put the access token in \"Authorization\" header.", "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/orcasgit/django-tastypie-oauth", "keywords": null, "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "django-tastypie-oauth", "package_url": "https://pypi.org/project/django-tastypie-oauth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-tastypie-oauth/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/orcasgit/django-tastypie-oauth" }, "release_url": "https://pypi.org/project/django-tastypie-oauth/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "Providing OAuth services for Tastypie APIs", "version": "0.0.3" }, "last_serial": 1478709, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "b8d531c3170c2eab4ebcca57e77dfea1", "sha256": "3a2e483a504c79e870172e5fa62813d76560d301810bdc3ec2dfd63ea9d5047c" }, "downloads": -1, "filename": "django-tastypie-oauth-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b8d531c3170c2eab4ebcca57e77dfea1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2949, "upload_time": "2014-07-02T03:08:13", "url": "https://files.pythonhosted.org/packages/7f/0d/d7eedca1f48cc2eb42117cbfd379831bfa817783f4e72a89887edfaabb68/django-tastypie-oauth-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "2a2ff64dd21a62f1c4fb8d75eeb25997", "sha256": "3d31240340b02038991cdb55191557bfc23bf0ad068e6de4d9bebbf338ffd7c0" }, "downloads": -1, "filename": "django-tastypie-oauth-0.0.2.tar.gz", "has_sig": false, "md5_digest": "2a2ff64dd21a62f1c4fb8d75eeb25997", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7165, "upload_time": "2014-07-02T03:24:32", "url": "https://files.pythonhosted.org/packages/87/5d/743ac3b121ddc7be0b1702cf6fc77985b83285eafffeb2eb15b42342ce19/django-tastypie-oauth-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "586175d99f079ba130edab7ede40115f", "sha256": "b7b619486d406cb3f7db7ef13f6c38731415100d46f57d05f580a895d6c44838" }, "downloads": -1, "filename": "django-tastypie-oauth-0.0.3.tar.gz", "has_sig": false, "md5_digest": "586175d99f079ba130edab7ede40115f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9538, "upload_time": "2015-03-26T14:30:29", "url": "https://files.pythonhosted.org/packages/5a/b5/5331bf3380d7f111390bf55c8da61f4031cd3f1f92291ce6ad2bf5b6fb1c/django-tastypie-oauth-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "586175d99f079ba130edab7ede40115f", "sha256": "b7b619486d406cb3f7db7ef13f6c38731415100d46f57d05f580a895d6c44838" }, "downloads": -1, "filename": "django-tastypie-oauth-0.0.3.tar.gz", "has_sig": false, "md5_digest": "586175d99f079ba130edab7ede40115f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9538, "upload_time": "2015-03-26T14:30:29", "url": "https://files.pythonhosted.org/packages/5a/b5/5331bf3380d7f111390bf55c8da61f4031cd3f1f92291ce6ad2bf5b6fb1c/django-tastypie-oauth-0.0.3.tar.gz" } ] }