名称: local-places
描述: 通过本地 Google Places API 代理搜索地点(餐厅、咖啡馆等)。
主页: https://github.com/Hyaxia/local_places
元数据: {"clawdbot":{"emoji":"📍","requires":{"bins":["uv"],"env":["GOOGLE_PLACES_API_KEY"]},"primaryEnv":"GOOGLE_PLACES_API_KEY"}}
快速发现周边地点
通过本地 Google Places API 代理搜索附近地点。采用两步流程:先解析位置,再进行搜索。
cd {baseDir}
echo "GOOGLE_PLACES_API_KEY=your-key" > .env
uv venv && uv pip install -e ".[dev]"
uv run --env-file .env uvicorn local_places.main:app --host 127.0.0.1 --port 8000
需要在 .env 文件或环境变量中设置 GOOGLE_PLACES_API_KEY。
检查服务状态: curl http://127.0.0.1:8000/ping
解析位置:
curl -X POST http://127.0.0.1:8000/locations/resolve \
-H "Content-Type: application/json" \
-d '{"location_text": "Soho, London", "limit": 5}'
curl -X POST http://127.0.0.1:8000/places/search \
-H "Content-Type: application/json" \
-d '{
"query": "coffee shop",
"location_bias": {"lat": 51.5137, "lng": -0.1366, "radius_m": 1000},
"filters": {"open_now": true, "min_rating": 4.0},
"limit": 10
}'
curl http://127.0.0.1:8000/places/{place_id}
location_bias 进行搜索。filters.types:必须且只能指定一个类型(例如 "restaurant"、"cafe"、"gym")。filters.price_levels:整数 0-4(0=免费,4=非常昂贵)。filters.min_rating:0-5,以 0.5 为增量。filters.open_now:布尔值。limit:搜索时为 1-20,解析位置时为 1-10。location_bias.radius_m:必须大于 0。{
"results": [
{
"place_id": "ChIJ...",
"name": "Coffee Shop",
"address": "123 Main St",
"location": {"lat": 51.5, "lng": -0.1},
"rating": 4.6,
"price_level": 2,
"types": ["cafe", "food"],
"open_now": true
}
],
"next_page_token": "..."
}
如需获取更多结果,可在下一次请求中将 next_page_token 作为 page_token 参数传入。