2014-02-14 2 views
3

이것은 n00b 질문이지만 필자는 내가 가지고있는 프로젝트에서 새로운 FSharp.Data 2.0.0-alpha6 라이브러리를 사용하려고 생각했습니다. 특히 HTTP 기본 인증 (사용자 이름과 암호)으로 보호되는 웹 서비스에서 JSON 메시지를 읽으려고합니다.JsonProvider의 요청에 HTTP 기본 인증을 사용하고 샘플 파일이없는 유형을 추론하는 방법은 무엇입니까?

JsonProvider (또는 다른 제공 업체)은 허가에 의해 입증 된 URL의 문서를 읽을 수 있습니까?이 경우에는 HTTP 기본 인증?

을하지만 읽기 : I 별도로 샘플 파일을 다운로드해야 것 같습니다 다음 SO 질문을 판단하여

구스타보의 덧글은 F# News: Downloading stock prices에 달하고 있습니다.

샘플 파일을 별도로 다운로드해야하는 경우에도 JsonProvider을 사용하여 HTTP 기본 인증이 필요한 리소스의 문서를 구문 분석하는 방법은 무엇입니까?

내 mininimal 가공 샘플이 현재 지원되지 않는

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 

답변

4

이지만, 우리가 끌어 오기 요청을 수락 구현하기 너무 어렵지 않을 것이다. https://github.com/fsharp/FSharp.Data/issues/158

+1

이 질문에 대한 답변입니다. 현재 전화를 받고 있습니다 만, 내가 제공 한 링크를 따라갈 것입니다. – Veksi