Fake store API returns 524

Viewed 133

I've found this api and tried to test it's "login user" feature with this code:

import requests

url = "https://fakestoreapi.com/auth/login"
data = {'login': "mor_2314", 'password': "83r5^_"}

result = requests.post(url, json=data)

print(result)

the request takes a lot of time to go through and after that It prints <response [524]>, not a token as shown in the documentation,

is there something wrong with the code?

1 Answers

'login' should be 'username' in your data payload.

>>> data = {'username': "mor_2314", 'password': "83r5^_"}
>>> result = requests.post(url, json=data)
>>> print(result)
<Response [200]>
Related