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

标签 api rest visual-studio-2015 restsharp

    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/

相关文章:

ruby - 从 Ruby 控制台测试 Ruby on Rails OAuth API

android - 还有什么我尝试导入 "Unable to resolve target ' android- 出现 8'"错误

java - Docusign - 通过 Rest API 上传品牌简介

node.js - Visual Studio 2015 社区版,打开文件夹丢失

api - 如何通过 Travis API 列出给定项目的所有构建?

ios - UITableView 上的 JSON 数据

php - 如何从yii2 restful api中的两个表将关系数据显示为json格式

java - 订单管理系统的Rest API设计

c++ - Stat() 函数返回值 -1,因此无法访问文件属性。我该如何纠正这个问题?

c - snprintf 的输出是否保证在 Visual Studio 2015 中以 null 终止?