]> git.g-eek.se Git - eti2-trainhack-2017.git/commitdiff
Update to python api test and stations requests
authorGustav Eek <gustav.eek@etraveli.com>
Sun, 10 Sep 2017 15:12:10 +0000 (17:12 +0200)
committerGustav Eek <gustav.eek@etraveli.com>
Sun, 10 Sep 2017 15:12:10 +0000 (17:12 +0200)
apitest/tests/a-test.py
stations.py

index a5f99a08c0f1d366e2dda565cfec3b7dfd98c854..71d0aad9752a442d9fe979204db640b5090b7fa7 100644 (file)
@@ -3,7 +3,6 @@
 import xml.etree.ElementTree as ET
 import re
 
-
 tree = ET.parse('respons.xml')
 response = root = tree.getroot()
 
@@ -28,3 +27,7 @@ for c in n:
     print c.tag, c.attrib, len(c), c.text
 
 station_names = [n[0].text for n in result]
+
+p = re.compile('.*B.*')
+matching_station_names = [n[0].text for n in result if p.match(n[0].text)]
+print matching_station_names
index 130d3b3f8bee0b4d7d12bfc5676428e58ee69def..2d0954e00ea853af25b93dea6059f80d3d5eeae2 100644 (file)
@@ -25,7 +25,7 @@ def get_train_stations ():
     """
 
     conn = httplib.HTTPConnection(BASE_URL, PORT)
-    conn.request("POST", "", xml_request, HEADERS)
+    conn.request("POST", BASE_URL, xml_request, HEADERS)
     response = conn.getresponse()
     print response.status, response.reason # 303 Found
     xml_data = response.read()