Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -163,22 +163,13 @@ def get_route(start_coord, end_coord):
|
|
| 163 |
}
|
| 164 |
url = f"https://api.openrouteservice.org/v2/directions/driving-car?api_key={api_key}&start={start_coord[0]},{start_coord[1]}&end={end_coord[0]},{end_coord[1]}"
|
| 165 |
|
| 166 |
-
# Debugging: Display the request URL for verification
|
| 167 |
-
st.write("Requesting URL:", url)
|
| 168 |
|
| 169 |
# Make the API request
|
| 170 |
response = requests.get(url, headers=headers)
|
| 171 |
|
| 172 |
-
# Debugging: Check and display the response status
|
| 173 |
-
st.write(f"Response Status Code: {response.status_code}")
|
| 174 |
-
|
| 175 |
if response.status_code == 200:
|
| 176 |
data = response.json()
|
| 177 |
-
|
| 178 |
-
# Debugging: Display a portion of the response for inspection
|
| 179 |
-
st.write("API call successful. Here's a preview of the response data:")
|
| 180 |
-
st.json(data) # Displaying the full response might be overwhelming; consider showing just a part of it
|
| 181 |
-
|
| 182 |
if 'features' in data and len(data['features']) > 0:
|
| 183 |
route = data['features'][0]['geometry']['coordinates']
|
| 184 |
|
|
|
|
| 163 |
}
|
| 164 |
url = f"https://api.openrouteservice.org/v2/directions/driving-car?api_key={api_key}&start={start_coord[0]},{start_coord[1]}&end={end_coord[0]},{end_coord[1]}"
|
| 165 |
|
|
|
|
|
|
|
| 166 |
|
| 167 |
# Make the API request
|
| 168 |
response = requests.get(url, headers=headers)
|
| 169 |
|
|
|
|
|
|
|
|
|
|
| 170 |
if response.status_code == 200:
|
| 171 |
data = response.json()
|
| 172 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
if 'features' in data and len(data['features']) > 0:
|
| 174 |
route = data['features'][0]['geometry']['coordinates']
|
| 175 |
|