标签:https lex enc weixin color str grant com data
get
url = "https://api.weixin.qq.com/sns/jscode2session" data = { appid: "××××", secret: "×××××", js_code: params[:code].to_s, grant_type: ‘authorization_code‘ } response = RestClient.get url, params: data, :accept => :json body = JSON.parse(response.body)
post
url = "https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?access_token=××××××"
posts = {text: "8888"} posts.encode! "GBK", "UTF-8"//如果需要编码再用这个 res = RestClient.post url, posts, :content_type => "application/json", :accept => :json res.encode! "UTF-8", "GBK" res = JSON.parse(res.body)
rest-client restclient get post写法
标签:https lex enc weixin color str grant com data
原文地址:https://www.cnblogs.com/znsongshu/p/9462352.html