Compare commits
No commits in common. "0f6c06ada19af26f7bf59382665c5b699bbfd6ce" and "ffc5469f91c41802324d9b3a4f4f1205c0a35de7" have entirely different histories.
0f6c06ada1
...
ffc5469f91
19
main.py
19
main.py
|
|
@ -8,8 +8,7 @@ from typing import Dict, Any, Optional, List
|
|||
from fastapi import FastAPI, HTTPException, Depends
|
||||
|
||||
from public_function.public_func import read_config
|
||||
from model.model import CrawlerTask, AccountDelete, DataReceive
|
||||
from model.model import AccountCreate, AccountUpdate, DeviceResetData
|
||||
from model.model import AccountCreate, AccountUpdate, CrawlerTask, AccountDelete, DataReceive
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
|
@ -136,21 +135,5 @@ async def crawler_task(task_data: CrawlerTask, task_manager: Any = Depends(get_t
|
|||
raise HTTPException(status_code=500, detail="获取数据失败;失败原因{}".format(e))
|
||||
|
||||
|
||||
@app.get("/device_reset", summary="爬虫任务调用接口")
|
||||
async def device_reset(task_data: CrawlerTask, reset_manager: Any = Depends(get_reset_manager)):
|
||||
"""设备重置接口"""
|
||||
try:
|
||||
params = task_data.dict()
|
||||
params['task_id'] = uuid.uuid4().hex
|
||||
# 将任务记录到mysql
|
||||
# result = await task_manager.task_distribution(params)
|
||||
# if result:
|
||||
# return {"code": 200, "message": "<UNK>", "data": result}
|
||||
raise HTTPException(status_code=404, detail="抓取商品数据失败,请重新尝试")
|
||||
except Exception as e:
|
||||
print(f"<UNK>: {e}")
|
||||
raise HTTPException(status_code=500, detail="获取数据失败;失败原因{}".format(e))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
uvicorn.run(app)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,3 @@ class DataReceive(BaseModel):
|
|||
goods_id: str = Field(..., description="商品ID")
|
||||
country: str = Field(..., description="国家")
|
||||
goods_info: Dict[str, Any] = Field(..., description="商品信息")
|
||||
|
||||
|
||||
class DeviceResetData(BaseModel):
|
||||
device_id: str = Field(..., description="设备ID")
|
||||
|
|
|
|||
Loading…
Reference in New Issue