A
A
Alexander B2017-07-15 14:16:34
JavaScript
Alexander B, 2017-07-15 14:16:34

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:
35e167379c1249b7935572605d4e0a86.png
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

2 answer(s)
A
artem78, 2017-07-15
@artem78

Something like this:

params = {
  # Параметры запроса
}
r = requests.get('http://mysite.ru/', params = params)
if r.json().get('status') == 2001:
  print('Пользователь авторизован')

N
Nikolay Semenov, 2017-07-15
@nickola105

Parse the response body into an object and access the field, right?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question