文字识别api调用不能设置代理
Ta的回复 :static void Main(string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); RestClient client = new RestClient("https://aip.baidubce.com"); //设置代理后接口返回400 //client.Proxy = new WebProxy("172.16.0.53",8888); client.Encoding = Encoding.GetEncoding("GBK"); var request = new RestRequest("/rpc/2.0/nlp/v1/lexer", Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddQueryParameter("access_token", "your token"); request.AddJsonBody(new Dictionary<string, string> { ["text"] = "测试数据" }); var response = client.Execute(request); response.ContentEncoding = "GBK"; response.Content = Encoding.GetEncoding("GBK").GetString(response.RawBytes); }