Configuration for the Apify API client.
Every API function accepts a prebuilt configuration as
config: %ApifyClient.Config{}, or the options of new/1 directly
(token: ...). See ApifyClient.Client for how they are combined.
Summary
Functions
Returns the versioned base URL for API calls.
Creates a configuration.
Returns the versioned public base URL.
Types
@type t() :: %ApifyClient.Config{ base_url: String.t(), json_library: module(), max_retries: non_neg_integer(), min_delay_between_retries_ms: non_neg_integer(), public_base_url: String.t(), timeout_ms: non_neg_integer(), token: String.t() | nil, user_agent_suffix: String.t() | nil }
Functions
Returns the versioned base URL for API calls.
Creates a configuration.
The configuration is not read from the application environment (see
the Elixir library guidelines).
Build it in your application, from your own configuration, and pass it to the
calls as config::
defmodule MyApp.Apify do
def config do
ApifyClient.Config.new(token: Application.fetch_env!(:my_app, :apify_token))
end
end
ApifyClient.Actors.call("apify/web-scraper", input, config: MyApp.Apify.config())Options
:token- Apify API token. Without one, requests are sent unauthenticated, which works only for public endpoints (the Store, public Actors). The token is never read from the environment; passtoken: System.fetch_env!("APIFY_TOKEN")to use the environment variable.:base_url- base URL of the API (default:"https://api.apify.com"):public_base_url- public base URL of the API (default::base_url):max_retries- retries for rate limits, server and network errors (default: 8):min_delay_between_retries_ms- delay before the first retry; doubles with every retry (default: 500):timeout_ms- receive timeout per request (default: 360_000):user_agent_suffix- appended to theUser-Agentheader:json_library-ApifyClient.JSONadapter (default:config :apify_client, :json_library, thenApifyClient.JSON.Native)
Returns the versioned public base URL.