Add crossway api for traffic_lights

This commit is contained in:
David Eder
2021-06-08 14:57:31 +02:00
parent c0a87c7700
commit 026e4d6f9d
2 changed files with 15 additions and 4 deletions
+11 -3
View File
@@ -28,10 +28,18 @@ def get_cars():
return json_util.dumps({'cursor': cars})
@app.route('/api/v1/resources/traffic_lights', methods=['GET'])
def get_traffic_lights():
@app.route('/api2')
def api2():
return 'api2'
try:
response = requests.get(ENTITY_IDENT_URL + 'traffic_lights')
traffic_lights = response.json()['cursor']
except requests.exceptions.ConnectionError as e:
print("Is the entity_ident_server running and reachable?")
raise e
return json_util.dumps({'cursor': traffic_lights})
if __name__ == '__main__':