Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Django REST API

Project Description
# Django REST API

In settings :
```python
REST_AUTH_SESSION_ENGINE = "my_site.auth.AuthSession"
```

Example of this class :
```python
from rest_api.auth import BaseAuthREST

class AuthSession(BaseAuthREST):
def __init__(self, request):
self.request = request
try:
if 'HTTP_AUTHORIZATION' in request.META:
self.login_api_key(request.META['HTTP_AUTHORIZATION'])
except AuthApiKeyBad:
raise ResponseForbidden(details=["Mauvaise clé API."])
except AuthApiKeyExpire:
raise ResponseForbidden(details=["Clé API expirée."])

def is_connected(self):
return ...

def check_right(self, rights, _all=False):
return ...
```

Register API :
```python
from django.conf.urls import patterns, url, include
from rest_api.register import RegisterAPI
from my_site.api_v1.user import UserAPI
from my_site.api_v1.project import ProjectAPI

api_v1 = RegisterAPI("1.0")
api_v1.register(UserAPI()) # /api/1.0/user
api_v1.register(ProjectAPI()) # /api/1.0/project

urlpatterns = patterns(
'my_site',
url(r'^api/', include(api_v1.urls))
)
```
Release History

Release History

This version
History Node

0.0.3

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_rest_api-0.0.3-py3-none-any.whl (6.9 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Mar 20, 2015
django-rest-api-0.0.3.zip (8.9 kB) Copy SHA256 Checksum SHA256 Source Mar 20, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting