{“ detail”:“无效的凭据”}。帐户详细信息正确,但是仍然会出现此错误

时间:2019-06-21 05:42:43

标签: django-rest-framework python-requests jwt-auth

我正在用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)

0 个答案:

没有答案