Answer the question
In order to leave comments, you need to log in
How to get status in json?
There is a site on which the server checks whether the user is registered or not. If there is, then the following json is loaded:
And nothing happens on the page. We need to check status for 2001 and display a message that it is already registered. How can this be organized?
I don't even know how to phrase it to ask Google. Therefore, I turn to you.
Answer the question
In order to leave comments, you need to log in
Something like this:
params = {
# Параметры запроса
}
r = requests.get('http://mysite.ru/', params = params)
if r.json().get('status') == 2001:
print('Пользователь авторизован')
Parse the response body into an object and access the field, right?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question