def get_access_token(self, request):
        """
        Get the access token based on a request.

        Returns None if no authentication details were provided. Raises
        AuthenticationFailed if the token is incorrect.
        """
        header = authentication.get_authorization_header(request)
        if not header:
            return None
        header = header.decode(authentication.HTTP_HEADER_ENCODING)

        auth = header.split()

        if auth[0].lower() != 'bearer':
            return None

        if len(auth) == 1:
            msg = 'Invalid "bearer" header: No credentials provided.'
            raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2:
            msg = 'Invalid "bearer" header: Credentials string should not contain spaces.'
            raise exceptions.AuthenticationFailed(msg)

        return auth[1]
def get_access_token ( self , request ) : header = authentication . get_authorization_header ( request ) if not header : return None header = header . decode ( authentication . HTTP_HEADER_ENCODING ) auth = header . split ( ) if auth [ 0 ] . lower ( ) != 'bearer' : return None if len ( auth ) == 1 : msg = 'Invalid "bearer" header: No credentials provided.' raise exceptions . AuthenticationFailed ( msg ) elif len ( auth ) > 2 : msg = 'Invalid "bearer" header: Credentials string should not contain spaces.' raise exceptions . AuthenticationFailed ( msg ) return auth [ 1 ]
Get the access token based on a request.

        Returns None if no authentication details were provided. Raises
        AuthenticationFailed if the token is incorrect.