  try:
      import oauth_provider
      from oauth_provider.store import store as oauth_provider_store
  except (ImportError, ImproperlyConfigured):
      oauth_provider = None
      oauth_provider_store = None
      check_nonce = None
  
 
</s> remove         from oauth_provider.models import Consumer, Resource
 </s> add         from oauth_provider.models import Consumer, Scope </s> remove from rest_framework.compat import oauth2_provider, provider_now
 </s> add from rest_framework.compat import oauth2_provider, provider_now, check_nonce </s> remove         read_write_access_token.resource.is_readonly = False
        read_write_access_token.resource.save()
 </s> add         read_write_access_token.scope.is_readonly = False
        read_write_access_token.scope.save() </s> remove         self.resource = Resource.objects.create(name="resource name", url="api/")
        self.token = OAuthToken.objects.create(user=self.user, consumer=self.consumer, resource=self.resource,
 </s> add         self.scope = Scope.objects.create(name="resource name", url="api/")
        self.token = OAuthToken.objects.create(user=self.user, consumer=self.consumer, scope=self.scope,
    # check_nonce's calling signature in django-oauth-plus changes sometime
    # between versions 2.0 and 2.2.1
    def check_nonce(request, oauth_request, oauth_nonce, oauth_timestamp):
        check_nonce_args = inspect.getargspec(oauth_provider_store.check_nonce).args
        if 'timestamp' in check_nonce_args:
            return oauth_provider_store.check_nonce(
                request, oauth_request, oauth_nonce, oauth_timestamp
            )
        return oauth_provider_store.check_nonce(
            request, oauth_request, oauth_nonce
        )

  try:
      import oauth_provider
      from oauth_provider.store import store as oauth_provider_store
    # check_nonce's calling signature in django-oauth-plus changes sometime
    # between versions 2.0 and 2.2.1
    def check_nonce(request, oauth_request, oauth_nonce, oauth_timestamp):
        check_nonce_args = inspect.getargspec(oauth_provider_store.check_nonce).args
        if 'timestamp' in check_nonce_args:
            return oauth_provider_store.check_nonce(
                request, oauth_request, oauth_nonce, oauth_timestamp
            )
        return oauth_provider_store.check_nonce(
            request, oauth_request, oauth_nonce
        )

  except (ImportError, ImproperlyConfigured):
      oauth_provider = None
      oauth_provider_store = None
      check_nonce = None
  
keep keep add keep keep keep keep keep
 Compat fixes for django-oauth-plus versions 2.0-2.2.1 
rest_framework/compat.py