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, if 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 (the host owns its browser).

§browser_bin: Option<PathBuf>

Browser binary path for the inline host, for when auto-discovery can’t find one. Ignored when –endpoint-url is set.

§render: RenderArg

Render strategy: none (HTTP fast path, no browser), auto (HTTP first, escalate to the browser on failure), or always (browser only).

§tab: String

Tab target: “new” allocates a temporary target and closes it after fetch; a CDP target id reuses that target and leaves it open (the same id afhttp cdp/upload/tabs accept).

§takeover: bool

Escalate to human takeover when a wall (captcha/login/2FA) is hit: keep a persistent tab open and return 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 capture on the browser path: 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>

JavaScript to evaluate after the wait condition resolves (repeatable). Runs in page context before artifacts are captured.

§want: Vec<String>

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

§method: String

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

§data: Option<String>

Request body as a string. Prefix with @ to read from a file path (e.g. --data @payload.json). Mutually exclusive with --form.

§form: Vec<String>

Add a form field (repeatable). Sends body as application/x-www-form-urlencoded. Mutually exclusive with --data. Format: name=value.

§network_bodies: NetworkBodiesArg

Capture response bodies for network requests: off, xhr (XHR/fetch only), or all.

§network_body_max_bytes: u64

Per-body cap for each captured network sub-request body, in bytes (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 redaction of sensitive values in network.json (redacted by default). Writes raw Authorization/Cookie headers and token-bearing query params to the artifact — only for trusted local debugging.

§out: Option<PathBuf>

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

§cookie_jar: Option<PathBuf>

Override the cookie-jar path. The default — derived from the host’s GET /profile — places the jar at <profile-dir>/cookies.jar.json. This override is rejected with invalid_argument if it does not match the host’s profile path; the flag exists for tests and forensic tooling, not production sessions. Honors AFHTTP_COOKIE_JAR when omitted (same validation applies).

§no_cookie_jar: bool

Opt out of cookie-jar persistence for this fetch. No cookies are replayed from the jar and no Set-Cookie responses are merged back.

§observe_main_wait_ms: u64

Upper bound on the browser-path wait for the main document network event, in milliseconds. Raise for slow networks or low-end machines.

§max_response_bytes: u64

Upper bound on the main HTTP-path response body, in bytes (see --network-body-max-bytes for captured network sub-request bodies). Default 1 GiB (1073741824). 0 disables the cap entirely. When the cap is hit, the fetch returns successfully with a network_body_truncated warning and the prefix bytes that were collected.

§retry: u32

Number of additional attempts after the first. Retries fire only when the error has retryable: true (e.g. host_unreachable, cdp_timeout); non-retryable failures (tls_error, wait_selector_unmatched, etc.) short-circuit. Default 0 = single attempt.

§backoff_ms: u64

Fixed delay between retries, in milliseconds.

§proxy: Option<String>

Per-fetch upstream HTTP/HTTPS proxy for the HTTP fast path. The SDK never honors HTTP_PROXY from the environment; this flag is the only way to route an HTTP-path fetch through one. Format: http://user:pass@host:port or socks5://host:port.

§ca_cert: Option<PathBuf>

Path to a PEM file containing extra root CAs to trust for this fetch’s HTTP path. Useful for self-signed staging or corporate MITM CAs.

§tls_insecure: bool

Disable TLS certificate verification for this fetch’s HTTP path. Dangerous; leaves the connection open to MITM. Use only against known-self-signed environments.

§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 to network-bodies/.frames.jsonl. Frames may carry bearer tokens, session IDs, and message content — treat the artifact as sensitive.

§capture_sse: bool

Capture SSE event payloads to network-bodies/.frames.jsonl. Events may carry PII; treat the artifact 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