Vek*_*ksi 3 authentication f# type-providers f#-data
这感觉是一个 n00b 问题,但我考虑过FSharp.Data 2.0.0-alpha6在我拥有的项目中尝试新库。具体来说,我试图从受 HTTP 基本身份验证(用户名和密码)保护的 Web 服务中读取 JSON 消息。
如何与JsonProvider(或任何其他提供者)一起从由授权处理的 URL 读取文档,在这种特殊情况下通过 HTTP 基本身份验证?
通过判断以下SO问题,我应该单独下载示例文件:
但随后阅读Gustavo在F# News 上的评论:下载股票价格让人希望它成为可能。
即使我必须单独下载示例文件,我将如何使用JsonProvider来解析需要 HTTP 基本身份验证的资源中的文档?
我的最小工作样本是
open System
open FSharp.Data
open FSharp.Data.JsonExtensions
//The URLs are something like the following.
//https://xyz.com/rest/v1/datanodes?limit=20&expand=name,processData.v,processData.ts$format=json
//This one tells in a tooltip it cannot read sample from the address
//as server respons with an error 401 Unauthorized.
type x1 = JsonProvider<"https://xyz.com/rest/v1/datanodes?&format=json">
[<EntryPoint>]
let main argv =
//This is just of type object, probably because connection can't be made?
let x2 = new JsonProvider<"https://xyz.com/rest/v1/datanodes?&format=json">
0
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1276 次 |
| 最近记录: |