···
2
+
* Copyright (c) 2014, OCaml.org project
3
+
* Copyright (c) 2015 KC Sivaramakrishnan <sk826@cl.cam.ac.uk>
5
+
* Permission to use, copy, modify, and distribute this software for any
6
+
* purpose with or without fee is hereby granted, provided that the above
7
+
* copyright notice and this permission notice appear in all copies.
9
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
+
(** River HTTP client using Requests library.
20
+
This module provides a session-based HTTP client for fetching RSS/Atom feeds.
21
+
The client manages a Requests session with appropriate defaults for feed fetching. *)
23
+
(** The type of a River HTTP client *)
26
+
(** [create ~sw env] creates a new River client with a Requests session.
28
+
The session is configured with:
29
+
- User-Agent: "OCaml-River/1.0"
30
+
- Automatic redirect following (max 5 redirects)
31
+
- TLS verification enabled
33
+
@param sw The switch for resource management
34
+
@param env The Eio environment providing network and time resources *)
37
+
< clock : float Eio.Time.clock_ty Eio.Resource.t;
38
+
fs : Eio.Fs.dir_ty Eio.Path.t;
39
+
net : [ `Generic | `Unix ] Eio.Net.ty Eio.Resource.t; .. > ->
42
+
(** [with_client env f] creates a client and automatically manages its lifecycle.
44
+
This is the recommended way to use the client as it ensures proper cleanup.
46
+
@param env The Eio environment
47
+
@param f The function to run with the client *)
49
+
< clock : float Eio.Time.clock_ty Eio.Resource.t;
50
+
fs : Eio.Fs.dir_ty Eio.Path.t;
51
+
net : [ `Generic | `Unix ] Eio.Net.ty Eio.Resource.t; .. > ->
54
+
(** [session t] returns the underlying Requests session.
56
+
This is used internally by River's HTTP functions. *)
57
+
val session : t -> (float Eio.Time.clock_ty Eio.Resource.t,
58
+
[`Generic | `Unix] Eio.Net.ty Eio.Resource.t) Requests.t