Skip to content

Instantly share code, notes, and snippets.

@DavidLutton
Created May 21, 2019 22:57
Show Gist options
  • Save DavidLutton/85653f3e4d0583c812f2ac97093727ce to your computer and use it in GitHub Desktop.
Save DavidLutton/85653f3e4d0583c812f2ac97093727ce to your computer and use it in GitHub Desktop.
import requests
# from pathlib import Path
from pprint import pprint
road = 'A1'
url = f'http://www.trafficengland.com/api/events/getByRoad?road={road}&events=CONGESTION,INCIDENT,ROADWORKS,MAJOR_ORGANISED_EVENTS,ABNORMAL_LOADS&direction=all&includeUnconfirmedRoadworks=true'
r = requests.get(url)
for event in r.json():
print(event)
# print(event['teEventType'], event['junction_ds_desc'], event['junction_us_desc'], event['cause'])
print('\n\n\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment