Перейти к содержимому

Как запросить из кода

Один и тот же запрос в терминале и в двух языках.

Эти фрагменты получают набор и разбирают его как JSON. Логику обработки добавьте по своему вкусу.

curl

curl -s https://packet4.study/v1/ref/http-status.json

Python

import urllib.request, json
url = "https://packet4.study/v1/ref/http-status.json"
data = json.load(urllib.request.urlopen(url))

fetch

const res = await fetch("https://packet4.study/v1/ref/http-status.json");
const data = await res.json();