fix: 快递100 OCR面单识别接口改用 HTTPS

HTTP 请求返回 404 HTML 页面,改为 HTTPS 解决。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wsb1224 2026-07-04 07:51:41 +08:00
parent a0d1e63ada
commit 03f55871d8

View File

@ -866,13 +866,14 @@ class LogisticsService:
}).encode("utf-8")
req = request.Request(
url="http://api.kuaidi100.com/elec/detocr",
url="https://api.kuaidi100.com/elec/detocr",
data=form_data,
headers={"Content-Type": "application/x-www-form-urlencoded"},
method="POST",
)
with request.urlopen(req, timeout=30) as resp:
result = json.loads(resp.read().decode("utf-8") or "{}")
raw = resp.read().decode("utf-8") or "{}"
result = json.loads(raw)
raw_result = result
# 5. 解析返回: data.waybill 为运单号, data.barcode 为条码