Django, how to get current request method? request is not working in my views.py
I'm new to Django. I'm trying to get my current request method to see if it is "POST" method.
But I got error message says: Unresolved reference 'request'
I tried to import request, but I don't know which one is correct.
Thanks for your help!
Have a look at the following:
import requests response = requests.post(url, data=body, headers=headers)
My bad, I shouldn't put the request as a variable in a class, request is supposed to work in the function