package quests

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Quests

Quests is an HTTP/1.1 client library using Cohttp. The API is closely inspired by Python's requests.

Cookbook

A GET request with parameters:

Quests.get "http://httpbin.org/get" ~params:[ ("key1", "value1"); ("key2", "value2") ]

A POST request with form-encoded data:

Quests.post "http://httpbin.org/post" ~data:(Form [ ("key1", "value1"); ("key2", "value2") ])

A POST request with JSON:

Quests.get "http://httpbin.org/post" ~data:(Json [%yojson { key = "value" }])

Custom headers:

Quests.get "https://example.com" ~headers:([ ("Accept-Language", "French") ])

Basic authentication:

Quests.get "https://postman-echo.com/basic-auth" ~auth:(Basic ("username", "password"))

Bearer authentication:

Quests.get "https://postman-echo.com/basic-auth" ~auth:(Bearer "a token")

Sessions (connection pooling):

let open Quests in
let s = Session.create () in
let response = Session.get s "https://example.com" in
let%lwt () = Session.close s in
response

Documentation

OCaml

Innovation. Community. Security.