Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. # Create your views here.
  2. from rest_framework.authentication import SessionAuthentication, BasicAuthentication
  3. from rest_framework.permissions import IsAuthenticated
  4. from rest_framework.response import Response
  5. from rest_framework.views import APIView
  6. from rest_framework.decorators import api_view,authentication_classes,permission_classes
  7. from django.contrib.auth.decorators import permission_required,login_required
  8. import google.cloud.storage
  9. import uuid
  10. import psycopg2
  11.  
  12.  
  13. @api_view(['GET'])
  14. @authentication_classes((SessionAuthentication, BasicAuthentication))
  15. @permission_classes((IsAuthenticated,))
  16. def auth_test(request):
  17. return Response("it's great to have you here with token auth!!")
  18.  
  19. @api_view(['GET'])
  20. def free_test(request):
  21. #print(request.META['HTTP_AUTHORIZATION'])
  22. return Response("entry without token auth !!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement