Uzyskaj prośby z Pythona
import requests
response = requests.get('<api-endpoint>')
response.raise_for_status()
data = response.json()
print(data)
Tejas Naik
import requests
response = requests.get('<api-endpoint>')
response.raise_for_status()
data = response.json()
print(data)
import requests
url = 'https://codegrepper.com/'
response = requests.get(url)
print('URL: ', response.url)
print('Status code: ', response.status_code)
print('HTTP header: ', response.headers)
# pip install requests
import requests
req = requests.get('<url here>', 'html.parser')
print(req.text)
import requests
r = requests.get('https://api.github.com', auth=('user', 'pass'))
print r.status_code
print r.headers['content-type']
app.get('/data', function (req, res) {
res.send('welcome!');
});