CloakedReq (cloaked_req v0.3.2)

Copy Markdown View Source

Req adapter powered by Rust wreq.

Summary

Functions

Attaches CloakedReq adapter behavior to an existing Req.Request.

Sets the impersonation profile and configures the CloakedReq Req adapter.

Functions

attach(request, options \\ [])

@spec attach(
  Req.Request.t(),
  keyword()
) :: Req.Request.t()

Attaches CloakedReq adapter behavior to an existing Req.Request.

Supported custom adapter options:

  • :cookie_jar - %CloakedReq.CookieJar{} for automatic cookie persistence
  • :impersonate - profile atom (e.g. :chrome_136, :"safari_17.4.1")
  • :insecure_skip_verify - boolean
  • :local_address - outbound source IP as string, IPv4 tuple, or IPv6 tuple
  • :max_body_size - positive integer or :unlimited (default: 10 MB)

Examples

iex> req = Req.new(url: "https://example.com") |> CloakedReq.attach(impersonate: :chrome_136)
iex> is_function(req.adapter, 1)
true
iex> Req.Request.get_option(req, :impersonate)
:chrome_136

impersonate(request, profile)

@spec impersonate(Req.Request.t(), atom()) :: Req.Request.t()

Sets the impersonation profile and configures the CloakedReq Req adapter.

Examples

iex> req = Req.new(url: "https://example.com") |> CloakedReq.impersonate(:chrome_136)
iex> Req.Request.get_option(req, :impersonate)
:chrome_136
iex> is_function(req.adapter, 1)
true