[Python] 纯文本查看 复制代码 import requests
import json
url = 'https://aip.baidubce.com/rest/2.0/ocr/v1/accurate?access_token=24.9dd8bc1680d45c8b8cec312f9a2a84af.2592000.1667486887.282335-18897731'
headers = {
'User-Agent': 'Apache-HttpClient/4.5.6 (java 1.5), bce-sdk-java/0.10.132/Linux/3.10.0_3-0-0-22/Java_HotSpot(TM)_64-Bit_Server_VM/25.45-b02/1.8.0_45/en/',
'x-bce-request-id': '228771b0667d48878fdde9dda626f945',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': 81,
'Postman-Token': '2cc74b7f-f63e-4c1d-aae2-efa9fb557f5d',
'Accept': '*/*',
'Connection': 'keep-alive',
'Referer': 'https://att.125.la/data/attachment/forum/202210/04/204345yym1zzhm131134y.bmp'
}
params = {
'url': 'https://att.125.la/data/attachment/forum/202210/04/204345yym1zzhm131134y.bmp'
}
data = {
'words_result': [{'words': '学', 'location': {'top': 4, 'left': 23, 'width': 71, 'height': 93}}, {'words': '跳', 'location': {'top': 23, 'left': 209, 'width': 40, 'height': 39}}, {'words': '底芬', 'location': {'top': 84, 'left': 87, 'width': 97, 'height': 51}}],
'words_result_num': 3,
'log_id': '1577310435660846055'
}
response = requests.post(url, headers=headers, params=params, data=json.dumps(data))
print(response.text)
|