|
16 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
|
18 | 18 | """ |
19 | | -Public transport stops and departures from ASEAG, Aachen Germany. |
| 19 | +Public transport stops and departures from ASEAG, Aachen, Germany. |
| 20 | +
|
20 | 21 | API not seperately documented but uses URA interface like TfL. |
21 | | -See: http://content.tfl.gov.uk/tfl-live-bus-river-bus-arrivals-api-documentation.pdf |
| 22 | +http://content.tfl.gov.uk/tfl-live-bus-river-bus-arrivals-api-documentation.pdf |
22 | 23 | """ |
23 | 24 |
|
| 25 | +import json |
24 | 26 | import pan |
25 | 27 | import urllib.parse |
26 | | -import json |
27 | 28 |
|
28 | 29 | RETURN_LIST = [ |
29 | 30 | "StopPointName", |
@@ -102,7 +103,7 @@ def find_nearby_stops(x, y): |
102 | 103 | """Return a list of stops near given coordinates.""" |
103 | 104 | radius = 500 |
104 | 105 | params = { |
105 | | - "Circle": str(y)+","+str(x)+","+str(radius), |
| 106 | + "Circle": "{:.6f},{:.6f},{:d}".format(y, x, radius), |
106 | 107 | "ReturnList": ",".join(RETURN_LIST), |
107 | 108 | } |
108 | 109 | url = format_url("/instant_V2", **params) |
@@ -140,10 +141,9 @@ def parsejson_find_nearby_stops(data): |
140 | 141 |
|
141 | 142 | def find_stops(query, x, y): |
142 | 143 | """Return a list of stops matching `query`.""" |
143 | | - query = urllib.parse.quote(query) |
144 | 144 | params = { |
145 | 145 | "maxResults": "10", |
146 | | - "searchString": query, |
| 146 | + "searchString": urllib.parse.quote(query), |
147 | 147 | "searchTypes": "STOPPOINT", |
148 | 148 | } |
149 | 149 | url = format_url("/location", **params) |
|
0 commit comments