Commit d93089c5 by hejiangming

no message

parent b441e323
......@@ -17,34 +17,6 @@ class ImageSearchRequest(BaseModel):
image_url: str = Field(..., description="图片的URL地址")
site_name: str = Field(default="us", description="站点简写, 如 us")
search_mode: str = Field(default="default", description="搜索模式")
# ======================
# 首页
# ======================
@app.get("/", response_class=HTMLResponse)
def index():
html_content = """
<html>
<head><meta charset="utf-8"><title>Amazon Image Search API</title></head>
<body style="font-family: Arial; padding:40px;">
<h1>📸 Amazon Image Search API (FastAPI)</h1>
<p style="color:green;font-weight:bold;">服务正在运行</p>
<h3>接口:</h3>
<p><b>POST /api/search_image</b></p>
<pre>
{
"image_url": "https://m.media-amazon.com/images/I/51i3aMcjmOL._SL600_.jpg",
"site_name": "us", // 可选: us
"search_mode": "default" // 可选: default, full_image
}
</pre>
<h3>健康检查:</h3>
<p><a href="/health">/health</a></p>
</body>
</html>
"""
return HTMLResponse(content=html_content)
# ======================
......@@ -177,9 +149,3 @@ def search_image_api(item: ImageSearchRequest):
return JSONResponse({"code": 500, "msg": str(e)}, status_code=500)
# ======================
# 健康检查
# ======================
@app.get("/health")
async def health():
return {"status": "ok", "service": "Amazon Image Search (FastAPI)"}
......@@ -39,7 +39,7 @@ def build_browser_headers():
v = profile["version"]
headers = {
"accept": "text/html,application/xhtml+xml,*/*",
"Accept-Language": "en-US,en;q=0.9",
"Accept-Language": "zh-CN,en;q=0.9",
"Accept-Encoding": "gzip, deflate",
"user-agent": profile["ua"],
"sec-ch-ua": f'"Chromium";v="{v}", "Google Chrome";v="{v}", "Not.A/Brand";v="99"',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment