Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.54 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.54 KB

Fable.Requests Nuget

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>)

Installation

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 requests@2.28.1

Compile and run your project

Requires Fable v4 (snake island)

cd ./path/to/proj
dotnet fable --lang python
poetry run python program.py