Skip to content

Instantly share code, notes, and snippets.

@johncant
Last active August 29, 2015 14:24
Show Gist options
  • Save johncant/5d821e09ca21564f6245 to your computer and use it in GitHub Desktop.
Save johncant/5d821e09ca21564f6245 to your computer and use it in GitHub Desktop.
##!/usr/bin/env python3
#
#import urllib.request
#
## Read XML from TFL website
#
#url = 'http://cloud.tfl.gov.uk/TrackerNet/LineStatus'
#response = urllib.request.urlopen(url)
#xml = response.read().decode('utf-8')
#
## Parse XML into a dict
#
#import xmltodict
#
#xmldict = xmltodict.parse(xml)
#
## Do the magic
#
#statuses = xmldict['ArrayOfLineStatus']['LineStatus']
#
#for status in statuses:
# print(status['Line']['@Name'] + '|' + status['Status']['@Description'])
#
# Refactored:
print("On strike")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment