using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Http.Headers;
using RestSharp;
namespace ConsoleProgram
{
public class TryingOutRest {
public resttest Execute<resttest>(RestRequest request) where resttest : new() {
var client = new RestClient();
client.BaseUrl = new Uri("http://www.ocrwebservice.com");
client.Authenticator = new HttpBasicAuthenticator("apid", "apikey");
// the key and and id are put in as a string, but i removed them for the purposes of this.
var re_quest = new RestRequest();
re_quest.Resource = "/restservices/processDocument";
var response = client.Execute<resttest>(request);
}
}
}
所以,嗨,我正在尝试掌握 Rest api,目前正在做一个涉及它和 OCR 的项目,正如您可能知道的那样。尝试过这个,我认为它会工作得很好,但我似乎已经搞砸了,或者一些命名已经改变,我在自动填充菜单中找不到任何相关的内容。 有人知道发生了什么事吗? 附注如果有关于安装的问题,我使用了 NuGet,所以我认为不会有问题。
最佳答案
关于api - C#、RestSharp、类型或命名空间名称 "HttpBasicAuthenticator"找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34776797/