Skip to content

Instantly share code, notes, and snippets.

@michiwend
Created March 6, 2014 23:42
Show Gist options
  • Save michiwend/9402105 to your computer and use it in GitHub Desktop.
Save michiwend/9402105 to your computer and use it in GitHub Desktop.
avv departure test
#!/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