I am sending a POST request to myself:
requests.post("http://localhost:8000/api/", json=data, auth=('myuser', 'mypwd'))
I am using Django to receive the POST request. I want to authenticate that the username and password matches what I have.
def myAPI(request)
if request.method == 'POST':
# obtain username and password here
How can I get the username and password in plain text? I've tried request.body.decode()
, request.POST.items()
, request.META
-- just can't find it! I could send the credentials over in data
and it would be easy. Alternatively, I can use an API key instead of both username and password, but I wouldn't know how to access that either.