python

Python ile REST API İsteği

Python requests ile API çağrısı, timeout, hata kontrolü ve JSON response okuma örneği.

// PYTHON //
import requests

response = requests.get('https://api.example.com/posts', timeout=10)
response.raise_for_status()

for post in response.json():
    print(post['title'])