ruby 请求示例
刘吉祥94 发布于2020-12 浏览:839 回复:1
0
收藏
快速回复

### get access token

api_key = '***************'
secret_key = '***************'
host = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=#{api_key}&client_secret=#{secret_key}"
response = Net::HTTP.get(URI(host))
access_token = JSON.parse(response)["access_token"]

### 识别图片

access_token = "***************"
uri = URI('https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token='+access_token)
params = {"image" => image_base64 }
res = Net::HTTP.post_form(uri, params)
puts res.body

收藏
点赞
0
个赞
共1条回复 最后由用户已被禁言回复于2022-04
#2深圳九曲范深回复于2020-12

什么问题

0
TOP
切换版块