Closed calwi closed 1 year ago
I'm trying to transpile a simple HTTP request with the HttpClient from System.Net.Http. Is this supported?
eg.
open System.Net.Http open System.IO open System.Threading
let getAsync (client:HttpClient) (url:string) = async { let! response = client.GetAsync(url) |> Async.AwaitTask response.EnsureSuccessStatusCode () |> ignore let! content = response.Content.ReadAsStringAsync() |> Async.AwaitTask return content }
let handler = new SocketsHttpHandler()
let client = new System.Net.Http.HttpClient(handler)
let content = getAsync (client) "https://github.com/fable-compiler/Fable.Python"
printfn "%s" (content |> Async.RunSynchronously) It just raises an exception in the Python
Hi, sorry but this is not supported. You would have to make a wrapper for Python libraries such as httpx or requests.
OK. Thanks Dag.
I'm trying to transpile a simple HTTP request with the HttpClient from System.Net.Http. Is this supported?
eg.
r "nuget: Fable.Python, 0.22.0"
r "nuget: Fable.Core, 3.7.1"
r "nuget: System.Net.Http, 4.3.4"
open System.Net.Http open System.IO open System.Threading
let getAsync (client:HttpClient) (url:string) = async { let! response = client.GetAsync(url) |> Async.AwaitTask response.EnsureSuccessStatusCode () |> ignore let! content = response.Content.ReadAsStringAsync() |> Async.AwaitTask return content }
let handler = new SocketsHttpHandler()
let client = new System.Net.Http.HttpClient(handler)
let content = getAsync (client) "https://github.com/fable-compiler/Fable.Python"
printfn "%s" (content |> Async.RunSynchronously) It just raises an exception in the Python