Skip to main content

Args

Struct Args 

Source
pub struct Args {
Show 37 fields pub url: String, pub endpoint: Option<String>, pub token: Option<String>, pub browser: BrowserArg, pub browser_bin: Option<PathBuf>, pub render: RenderArg, pub tab: String, pub takeover: bool, pub profile: Option<String>, pub wait: String, pub headers: Vec<String>, pub cookies: Vec<String>, pub user_agent: Option<String>, pub evaluate_after_wait: Vec<String>, pub want: Vec<String>, pub method: String, pub data: Option<String>, pub form: Vec<String>, pub network_bodies: NetworkBodiesArg, pub network_body_max_bytes: u64, pub readiness_idle_ms: u64, pub readiness_stable_ms: u64, pub readiness_min_text_bytes: u64, pub no_network_redact: bool, pub out: Option<PathBuf>, pub cookie_jar: Option<PathBuf>, pub no_cookie_jar: bool, pub observe_main_wait_ms: u64, pub max_response_bytes: u64, pub retry: u32, pub backoff_ms: u64, pub proxy: Option<String>, pub ca_cert: Option<PathBuf>, pub tls_insecure: bool, pub timeout_ms: u64, pub capture_ws: bool, pub capture_sse: bool,
}

Fields§

§url: String

URL to fetch.

§endpoint: Option<String>

CDP endpoint of a running host.

Omit to spawn an inline ephemeral host for ordinary browser fetches; with –takeover, omission discovers the standard local afhttp-host. Falls back to AFHTTP_ENDPOINT_URL.

§token: Option<String>

Bearer token for a protected host.

Use when the host was started with --token-secret. Falls back to AFHTTP_TOKEN_SECRET.

§browser: BrowserArg

Browser backend for the inline host.

Ignored when –endpoint-url is set because the host owns its browser.

§browser_bin: Option<PathBuf>

Browser binary path for the inline host.

Use when auto-discovery cannot find one. Ignored when –endpoint-url is set.

§render: RenderArg

Render strategy: none, auto, or always.

none uses the HTTP fast path without a browser, auto starts with HTTP and escalates on failure, and always uses the browser only.

§tab: String

Browser tab target: new or an existing CDP target ID.

new allocates a temporary target and closes it after fetch; an ID reuses that target and leaves it open (the same ID accepted by afhttp cdp, upload, and tabs).

§takeover: bool

Escalate captcha, login, or 2FA walls to human takeover.

Keeps a persistent tab open and returns its short-lived takeover URL in next_action, plus a re-fetch command for the same tab once the human clears the wall. Uses --endpoint-url / AFHTTP_ENDPOINT_URL when set; otherwise discovers the standard local afhttp-host container (build one with afhttp container install).

§profile: Option<String>

Host profile to use for this fetch.

Switches the host’s active profile if it differs (per-domain isolation), relaunching its browser. With --takeover and no --profile, the profile defaults to the URL’s registrable domain (eTLD+1). Requires a host via --endpoint-url, or the standard local takeover host discovered by --takeover.

§wait: String

Readiness signal before browser capture.

Values: auto | load | idle | selector: | selector-visible: | ms:.

§headers: Vec<String>

Add a request header (repeatable).

Format: Name:value (a space after the colon is allowed).

§cookies: Vec<String>

Add a request cookie (repeatable). Format: name=value.

§user_agent: Option<String>

Override the User-Agent header for this fetch.

§evaluate_after_wait: Vec<String>

Evaluate JavaScript after readiness (repeatable).

Runs in page context before artifacts are captured.

§want: Vec<String>

Artifacts to capture, comma-separated.

Defaults to body on the HTTP fast path and browser-default artifacts when rendering. content is the agent-oriented composed page view (content.md); content_json is its structured form with link/action candidates. storage is opt-in and sensitive (localStorage/IndexedDB).

§method: String

HTTP method. Common values: POST, PUT, PATCH, DELETE.

§data: Option<String>

Request body as a string or @FILE.

Prefix with @ to read from a file path (for example, --data @payload.json). Mutually exclusive with --form.

§form: Vec<String>

Add a URL-encoded form field (repeatable).

Sends application/x-www-form-urlencoded, uses name=value, and is mutually exclusive with --data.

§network_bodies: NetworkBodiesArg

Capture network response bodies: off, xhr, or all.

xhr captures XHR/fetch only.

§network_body_max_bytes: u64

Per-body byte cap for captured network sub-requests.

See --max-response-bytes for the main HTTP-path response body.

§readiness_idle_ms: u64

Network quiet window used by –wait auto, in milliseconds.

§readiness_stable_ms: u64

DOM/text unchanged window used by –wait auto, in milliseconds.

§readiness_min_text_bytes: u64

Low visible-text byte threshold for –wait auto quality warnings only.

§no_network_redact: bool

Disable sensitive-value redaction in network.json.

Writes raw Authorization/Cookie headers and token-bearing query parameters to the artifact. Use only for trusted local debugging.

§out: Option<PathBuf>

Directory in which to write artifacts.

Defaults to afhttp-out under the system temporary directory. Files persist there for inspection.

§cookie_jar: Option<PathBuf>

Override the profile cookie-jar path.

The default, derived from the host’s GET /profile, is <profile-dir>/cookies.jar.json. A mismatch with the host profile is rejected with invalid_argument; this flag is for tests and forensic tooling, not production sessions. Honors AFHTTP_COOKIE_JAR when omitted (same validation applies).

§no_cookie_jar: bool

Disable cookie-jar replay and persistence for this fetch.

No cookies are replayed and no Set-Cookie responses are merged back.

§observe_main_wait_ms: u64

Maximum wait for the browser’s main-document event, in milliseconds.

Raise for slow networks or low-end machines.

§max_response_bytes: u64

Maximum main HTTP-path response body size in bytes.

See --network-body-max-bytes for captured sub-requests. The default is 1 GiB (1073741824); 0 disables the cap. Hitting the cap returns the collected prefix successfully with a network_body_truncated warning.

§retry: u32

Number of retry attempts after the first.

Retries run only for retryable: true errors such as host_unreachable or cdp_timeout; non-retryable failures such as tls_error short-circuit. The default 0 means one total attempt.

§backoff_ms: u64

Fixed delay between retries, in milliseconds.

§proxy: Option<String>

Upstream proxy for this fetch’s HTTP fast path.

The SDK never honors ambient HTTP_PROXY; this flag is the only proxy route. Use http://user:pass@host:port or socks5://host:port.

§ca_cert: Option<PathBuf>

PEM file with extra root CAs for the HTTP path.

Useful for self-signed staging or corporate MITM CAs.

§tls_insecure: bool

Disable TLS certificate verification on the HTTP path.

Dangerous: leaves the connection open to MITM. Use only against a known self-signed environment.

§timeout_ms: u64

Overall fetch timeout, in milliseconds. Applies to both the HTTP fast path and the browser path.

§capture_ws: bool

Capture WebSocket frame payloads.

Writes network-bodies/.frames.jsonl. Frames may carry bearer tokens, session IDs, and message content; treat it as sensitive.

§capture_sse: bool

Capture SSE event payloads.

Writes network-bodies/.frames.jsonl. Events may carry PII; treat it as sensitive.

Trait Implementations§

Source§

impl Args for Args

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Debug for Args

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Args

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl Freeze for Args

§

impl RefUnwindSafe for Args

§

impl Send for Args

§

impl Sync for Args

§

impl Unpin for Args

§

impl UnsafeUnpin for Args

§

impl UnwindSafe for Args

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more