我正在用python为djangorest编写测试。首先应通过检查登录信息来给我令牌的测试。
它给我错误{"detail":"Invalid credentials"}
INITIAL = 'http://127.0.0.1:8000/'
AUTH_ENDPOINT = INITIAL + "api/token/auth/"
data = {
"username":"ubaid",
"password":"ubaid11"
}
headers= {
"Content-Type" : "application/json"
}
posted = requests.post(AUTH_ENDPOINT,data = json.dumps(data),headers = headers)
print(posted.text)
final = posted.json()["Token"]
print(final)