Swiss public transport API
The Transport API provides public timetable data for Swiss public transport, utilizing a web service from search.ch.
import requests
url = "https://timetable.search.ch/api/connections"
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors
print(response.json())
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")Last 50 checks (10 min intervals)