feat: implement FastAPI service to expose Shopee commission scraping automation via REST API
This commit is contained in:
@@ -26,13 +26,15 @@ async def get_commission_endpoint(req: CommissionRequest):
|
||||
|
||||
bot = ShopeeBot(device_ip=target_ip)
|
||||
|
||||
result = bot.get_commission(req.link)
|
||||
result = bot.get_commission_rate(req.link)
|
||||
|
||||
# Nếu đã có status thì gộp thẳng các thuộc tính của result vào JSON trả về
|
||||
if isinstance(result, dict) and "status" in result:
|
||||
return result
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"link": req.link,
|
||||
"commission": result,
|
||||
"connected_ip": target_ip if target_ip else "auto-detect"
|
||||
"commission": result
|
||||
}
|
||||
except Exception as e:
|
||||
logging.error(f"Lỗi API: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user