Add rate limiting to Wikipedia and BraveSearch APIs

Closes #133
This commit is contained in:
Claudio Ortolina
2026-03-25 11:38:17 +00:00
parent 766a1dd7ed
commit 0295e58e57
7 changed files with 33 additions and 10 deletions
+9 -2
View File
@@ -1,11 +1,13 @@
defmodule Wikipedia.Config do
@type t :: %__MODULE__{
user_agent: String.t(),
req_options: Keyword.t()
req_options: Keyword.t(),
api_cooldown: non_neg_integer()
}
defstruct user_agent: "change me",
req_options: []
req_options: [],
api_cooldown: 1000
@schema NimbleOptions.new!(
user_agent: [
@@ -17,6 +19,11 @@ defmodule Wikipedia.Config do
type: :keyword_list,
required: false,
default: []
],
api_cooldown: [
type: :integer,
required: false,
default: 1000
]
)