Home > ctaalerts

ctaalerts

Ctaalerts is a project mainly written in Python, it's free.

CTA Alerts api class

h2. CTAAlerts Api Consumer

ctaalerts.py harper reed ([email protected]) "http://nata2.org":http://nata2.org "@harper":http://twitter.com/harper


h3. What?!

This class will consume and parse the Chicago Transit Authority alerts system.

h3. How?!

Requires beautifulsoup. I don't like XML and python.

bq. >>> import ctaalerts

c = ctaalerts.CTAAlerts() c.route_status(route_id='11') {'errorcode': 0, 'timestamp': u'20100605 13:04', 'route_info': [{'routestatuscolor': u'06c', 'routestatus': u'Planned Reroute', 'routecolorcode': u'059', 'route': u'Lincoln/Sedgwick', 'serviceid': u'11', 'routeurl': u'http://www.transitchicago.com/riding_cta/busroute.aspx?RouteId=172'}]}

c.detailed_alerts(route_id='11') {'errorcode': 0, 'timestamp': u'20100605 13:04', 'errormessage': None, 'alerts': [{'severity_score': u'37', 'impact': u'Planned Reroute', 'event_end': u'20100607 12:00', 'headline': u'#11 Lincoln/Sedgwick & #49B North Western Temporary Reroute', 'severity_css': u'planned', 'severity_color': u'06c', 'impacted_service': [{'service_name': u'Lincoln/Sedgwick', 'service_backcolor': u'059', 'service_url': u'http://www.transitchicago.com/riding_cta/busroute.aspx?RouteId=172', 'service_textcolor': u'ffffff', 'service_type': u'B', 'service_id': u'11', 'service_type_description': u'Bus Route'}, {'service_name': u'North Western', 'service_backcolor': u'059', 'service_url': u'http://www.transitchicago.com/riding_cta/busroute.aspx?RouteId=200', 'service_textcolor': u'ffffff', 'service_type': u'B', 'service_id': u'49B', 'service_type_description': u'Bus Route'}], 'event_start': u'20100603 10:00', 'major_alert': u'0', 'full_description': u'


How does this affect my trip?
Southbound #11 Lincoln/Sedgwick and #49B North Western buses will operate via Western and Montrose to Montrose/Lincoln.
  • #11 buses will resume their normal route on Lincoln.
  • #49B buses will operate via Lincoln, Wilson, and Western to end their trips at the Western (Brown Line) station.
Northbound #11 buses will operate via Lincoln, Wilson, and Western to Leland, then continue their normal route on Western.
 
Northbound #49B buses will begin their trips at the Western (Brown Line) station, then continue their normal route on Western.
Why is service being changed?
Buses are rerouted due to the May Festival.
', 'alert_id': u'6307', 'alert_url': u'http://www.transitchicago.com/travel_information/alert_detail.aspx?AlertId=6307', 'short_description': u'Buses are rerouted due to the May Festival.', 'tbd': u'0'}]}


let me know if you have any questions.

"@harper":http://twitter.com/harper [email protected]

Previous:heroku-express