Add project-bound OAuth MCP queries and controlled analysis with scoped evidence, limits, timeouts and a nearby-model spatial query using EPSG:4326 inputs. Default nearby searches to 200 meters and five results. Integrate investigation messaging/presentation, health/readiness and typed history; remove duplicate web search and fix online simulation and compressed baseline writes. Include project migrations 023-025; keep local credentials and demo seeding excluded. Validation: 319 focused pytest checks; real PostGIS temporary-table regression; read-only Jinqian bridge radius comparison; cross-language MCP discovery/calls.
18 lines
554 B
Python
18 lines
554 B
Python
import logging
|
|
import re
|
|
|
|
|
|
class TiandituTokenFilter(logging.Filter):
|
|
def filter(self, record: logging.LogRecord) -> bool:
|
|
message = record.getMessage()
|
|
if "tianditu.gov.cn" in message:
|
|
record.msg = re.sub(r"([?&]tk=)[^&\s\"']+", r"\1[redacted]", message)
|
|
record.args = ()
|
|
return True
|
|
|
|
|
|
def install_tianditu_token_filter() -> None:
|
|
logger = logging.getLogger("httpx")
|
|
if not any(isinstance(item, TiandituTokenFilter) for item in logger.filters):
|
|
logger.addFilter(TiandituTokenFilter())
|