Created
March 6, 2014 23:42
-
-
Save michiwend/9402105 to your computer and use it in GitHub Desktop.
avv departure test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
from lxml import etree | |
import urllib | |
api_base = 'http://efa.avv-augsburg.de/avv/' | |
request = 'XML_DM_REQUEST' | |
params = { | |
'sessionID' : '0', | |
'type_dm' : 'stop', | |
'useRealtime' : '1', | |
'mode' : 'direct', | |
'name_dm' : '114', | |
'locationServerActive' : '1', | |
'limit' : '10' | |
} | |
data_obj = urllib.urlopen( api_base + request + '?' + urllib.urlencode(params) ) | |
xml_tree = etree.parse(data_obj) | |
for dep in xml_tree.getiterator(tag='itdDeparture'): | |
line = dep.find('itdServingLine') | |
print 'Linie ' + line.get('number') + ' in ' + dep.get('countdown') + ' Minuten richtung ' + line.get('direction') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment