mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-06-10 08:54:34 +02:00
Merge pull request #5 from zvx-echo6/extraction-1-remove-traffic-handler
Remove /api/traffic/flow handler (now served by navi-traffic)
This commit is contained in:
commit
cf74f1840b
1 changed files with 1 additions and 22 deletions
23
lib/api.py
23
lib/api.py
|
|
@ -17,7 +17,7 @@ import shutil
|
|||
import tempfile
|
||||
|
||||
import requests as http_requests
|
||||
from flask import Flask, request, jsonify, redirect, render_template, make_response
|
||||
from flask import Flask, request, jsonify, redirect, render_template
|
||||
from qdrant_client import QdrantClient
|
||||
from qdrant_client.models import Filter, FieldCondition, MatchValue
|
||||
from werkzeug.utils import secure_filename
|
||||
|
|
@ -1208,27 +1208,6 @@ def api_knowledge_stats():
|
|||
return jsonify(_cache['knowledge_stats'])
|
||||
|
||||
|
||||
|
||||
@app.route('/api/traffic/flow/<int:z>/<int:x>/<int:y>.png')
|
||||
def api_traffic_flow(z, x, y):
|
||||
"""Proxy TomTom traffic flow tiles to hide API key from frontend."""
|
||||
key = os.environ.get('TOMTOM_API_KEY')
|
||||
if not key:
|
||||
return 'Traffic service not configured', 503
|
||||
# Orbis Maps Traffic API (migrated from classic)
|
||||
url = f'https://api.tomtom.com/maps/orbis/traffic/tile/flow/{z}/{x}/{y}.png?key={key}&apiVersion=1&style=light'
|
||||
try:
|
||||
resp = http_requests.get(url, timeout=10)
|
||||
if resp.status_code != 200:
|
||||
return 'Upstream error', 502
|
||||
r = make_response(resp.content)
|
||||
r.headers['Content-Type'] = 'image/png'
|
||||
r.headers['Cache-Control'] = 'public, max-age=120'
|
||||
return r
|
||||
except Exception:
|
||||
return 'Upstream timeout', 504
|
||||
|
||||
|
||||
@app.route('/api/place/<osm_type>/<int:osm_id>')
|
||||
def api_place_detail(osm_type, osm_id):
|
||||
"""Proxy place details from local Nominatim or Overpass API."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue