Skip to content

Instantly share code, notes, and snippets.

@rombr
rombr / authentication.py
Created August 10, 2015 09:45
Simple key authentication for Django REST framework
# -*- coding:utf-8 -*-
from django.conf import settings
from rest_framework import authentication
from rest_framework import exceptions
class ApiKeyAuthentication(authentication.BaseAuthentication):
'''
Аутентификация по задаанным в настройках ключам
'''
@rombr
rombr / views.py
Created January 22, 2015 08:09
Django REST framework example code
# -*- coding:utf-8 -*-
from django.http import Http404
from django.conf import settings
import mongoengine
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework import status
from sx.apps.schemes import backend
from sx.apps.schemes.backends import SchemeNotFoundError