Fable library for making HTTP requests targeting Python and using the requests library under the hood.
This is the initial release still of the library and the API is subject to change. Use at your own risk. Contributions are welcome!
open Fable.Requests
let response = Requests.get "https://api.thecatapi.com/v1/images/search"
printfn $"Status code: {response.statusCode}"
printfn $"Response: {response.text}"
There are these functions:
Request.get(url: string, ?headers:Map<string, string>)
Request.post(url: string, ?data: string, ?headers:Map<string, string>)
Request.put(url: string, ?data: string, ?headers:Map<string, string>)
Request.delete(url: string, ?data: string, ?headers:Map<string, string>)
Request.head(url: string, ?data: string, ?headers:Map<string, string>)
Request.options(url: string, ?data: string, ?headers:Map<string, string>)
You can install this library using Femto when you are using Poetry to manage your Python dependencies
femto install Fable.Requests
Alternatively, you can install it manually
dotnet add package Fable.Requests
poetry add [email protected]
Requires Fable v4 (snake island)
cd ./path/to/proj
dotnet fable --lang python
poetry run python program.py