每天免费使用100次。授权公众号使用。文件大小限制:小于2M
https://fuwu.weixin.qq.com/service/detail/000ce4cec24ca026d37900ed551415
https://developers.weixin.qq.com/doc/offiaccount/Intelligent_Interface/OCR.html
https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html
AccessToken的有效期为2小时。请求的服务器地址需要在公众号后台配置IP白名单。
import requests
import json
appid= "xxx"
secret= "xxx"
# 定义请求的 URL
url = f"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appid}&secret={secret}"
# 发送 GET 请求
response = requests.get(url, headers={"Content-Type": "application/json"})
# 打印响应内容
print(response.status_code)
print(response.json())
https://fuwu.weixin.qq.com/service/detail/000ce4cec24ca026d37900ed551415
https://developers.weixin.qq.com/doc/oplatform/service_market/buyer_guideline/API/introduction.html
关键参数
import requests
import json
access_token = "xxx"
# 定义请求的 URL
url = f"https://api.weixin.qq.com/wxa/servicemarket?access_token={access_token}"
# 定义请求的 JSON 数据
data = {
"service": "wx79ac3de8bexxx",
"api": "OcrAllInOne",
"data": {
"img_url": "http://mmbiz.qpic.cn/mmbiz_jpg/7UFjuNbYxibu66xSqsQqKcuoGBZM77HIyibdiczeWibdMeA2XMt5oibWVQMgDibriazJSOibLqZxcO6DVVcZMxDKgeAtbQ/0",
"data_type": 3,
"ocr_type": 1
},
"client_msg_id": "id123"
}
# 发送 POST 请求
response = requests.post(url, headers={"Content-Type": "application/json"}, data=json.dumps(data))
# 打印响应内容
print(response.status_code)
print(response.json())
https://fuwu.weixin.qq.com/purchased/datadetail/wx57fb341ec95e6c29/000ce4cec24ca026d37900ed551415
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。