gpt4 book ai didi

api - C#、RestSharp、类型或命名空间名称 "HttpBasicAuthenticator"找不到

转载 作者:行者123 更新时间:2023-12-03 02:00:35 26 4
gpt4 key购买 nike

    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,所以我认为不会有问题。

最佳答案

尝试

using RestSharp.Authenticators;

现在这似乎是 HttpBasicAuthenticator 的命名空间。 (Github)

关于api - C#、RestSharp、类型或命名空间名称 "HttpBasicAuthenticator"找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34776797/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com