fix: 快递100 OCR面单识别接口改用 HTTPS
HTTP 请求返回 404 HTML 页面,改为 HTTPS 解决。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a0d1e63ada
commit
03f55871d8
@ -866,13 +866,14 @@ class LogisticsService:
|
|||||||
}).encode("utf-8")
|
}).encode("utf-8")
|
||||||
|
|
||||||
req = request.Request(
|
req = request.Request(
|
||||||
url="http://api.kuaidi100.com/elec/detocr",
|
url="https://api.kuaidi100.com/elec/detocr",
|
||||||
data=form_data,
|
data=form_data,
|
||||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||||
method="POST",
|
method="POST",
|
||||||
)
|
)
|
||||||
with request.urlopen(req, timeout=30) as resp:
|
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
|
raw_result = result
|
||||||
# 5. 解析返回: data.waybill 为运单号, data.barcode 为条码
|
# 5. 解析返回: data.waybill 为运单号, data.barcode 为条码
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user