Hey guys, did someone of you successfully implemen...
# support-questions
z
Hey guys, did someone of you successfully implemented SuperTokens into django rest framework? We're struggling with the api view implementation, where
@verify_session()
comes into play.
r
What's the error that you are seeing?
z
Copy code
backend_1 | File "/usr/local/lib/python3.8/site-packages/supertokens_python/recipe/session/api/implementation.py", line 51, in verify_session
backend_1 | method = normalise_http_method(api_options.request.method())
backend_1 | File "/usr/local/lib/python3.8/site-packages/supertokens_python/framework/django/django_request.py", line 45, in method
backend_1 | if self.request.method is None:
backend_1 | AttributeError: 'UserAPI' object has no attribute 'method'
r
How are you using the function? And which version of the SDK and which version of django are you using?
z
We're calling the function like this:
Copy code
from supertokens_python.recipe.session.framework.django.syncio import verify_session

class UserAPI(generics.RetrieveAPIView):
  serializer_class = UserSerializer
  @verify_session()
  def get_object(self):
    return self.request.user
django version
3.2.11
supertokens-python version
0.6.1
r
thanks! Will get back ASAP
z
Thanks!
r
In the meantime, could you please open an issue about this on our github (https://github.com/supertokens/supertokens-python) and we can have a look at it in detail there.
z
To be honest, I don't think that this is a problem with your sdk. I think it's because we're using the django approach for the django rest framework. But if you insist, I will open an issue.
r
I think that's the issue as well. We haven't designed the
verify_session
function to work in that way,. Though it would be nice if we would have done it the "django way". So we are investigating it. If you open an issue, you can keep track of the progress etc more easily.
z
Makes sense! I've just opened this issue: https://github.com/supertokens/supertokens-python/issues/105
r
thanks!
@User we have commented a possible solution in the above issue. Please have a look
z
@User Thank you! I'll check it out asap.