Skip to content

Configuration reference

The defaults are tuned for a long list of image URLs on an ordinary computer and connection. Most people change nothing.

Set an option in any of these ways; they all end up in the same DownloadConfig:

machyon.download("urls.csv", "images/", max_retries=8, referer="https://example.com/")
cfg = machyon.DownloadConfig(max_retries=8, referer="https://example.com/")
machyon.download("urls.csv", "images/", config=cfg)
machyon urls.csv -o images/ --retries 8 --referer https://example.com/
machyon.ini
[SETTINGS]
max_retries = 8
referer = https://example.com/

DownloadConfig.from_ini("machyon.ini"), or machyon --config machyon.ini. Keys are field names, in any case. Dictionary options (headers) can't be set from INI files; pass them in code or with --header.

All options

A flag shown as --no-adaptive turns a True default off. Options without a flag are available from Python and INI files only.

Concurrency

concurrencydefault 32CLI --concurrency

Starting number of in-flight requests. With adaptive=True this is only a starting point.

max_concurrencydefault 256CLI --max-concurrency

Hard ceiling for in-flight requests and the size of the connection pool.

adaptivedefault TrueCLI --no-adaptive

Tune concurrency live: grow while throughput improves, back off on 429s and errors.

hedgedefault TrueCLI --no-hedge

Near the end of a batch, race a duplicate request against stragglers; first one wins.

warm_startdefault True

Remember the best concurrency per host and start there next time.

profile_pathdefault ~/.machyon/profiles.json

Where warm-start profiles live. Default: ~/.machyon/profiles.json.

Retries and timeouts

max_retriesdefault 5CLI --retries

Retries per URL after the first attempt (timeouts, resets, 408/425/429/5xx), in each round: the pass and, with retry_failures, the final sweep.

backoffdefault 0.5

Base seconds for exponential backoff with jitter.

timeoutdefault 15.0CLI --timeout

Connect timeout and maximum silence between received bytes, in seconds.

max_request_timedefault 120.0

Hard cap for one attempt; extended automatically in proportion to large bodies.

max_retry_afterdefault 120.0

Upper bound on how long a server's Retry-After may pause a host.

HTTP

headersdefault {}CLI --header

Extra request headers (auth tokens, cookies, ...).

refererdefault NoneCLI --referer

Value of the Referer header sent with every request (hotlink-protected sites).

user_agentdefault browser identity

The User-Agent header. Default: one current, stable desktop browser identity.

verify_ssldefault TrueCLI --insecure

Verify TLS certificates. Turn off only for hosts you trust (--insecure).

tls_trustdefault 'native'CLI --tls-trust

Where trusted CAs come from: "native" (OS store via truststore, like your browser), "certifi" (Mozilla bundle, like requests) or "python" (Python's defaults).

use_compressiondefault True

False sends Accept-Encoding: identity.

Files

validatedefault TrueCLI --no-validate

Reject bodies that aren't images (HTML "soft 404" pages, JSON errors, ...).

verify_existingdefault FalseCLI --verify-existing

Before skipping a file that already exists, check it really is an image.

fsyncdefault False

Flush every file to physical disk before renaming it into place (slower, power-loss safe).

stream_thresholddefault 4 MiB

Bodies larger than this (or of unknown size) stream to disk and can resume with Range.

write_threadsdefault min(32, 4 × CPUs)

Threads for file I/O. Default: min(32, 4 x CPUs).

shard_sizedefault 200_000

Rows planned at a time; keeps memory flat for inputs of any size.

Reporting

progressdefault TrueCLI --no-progress

Show the progress bar.

log_dirdefault NoneCLI --log

Write a rotating machyon.log here. None = no log file.

metrics_dirdefault NoneCLI --metrics

Append a JSON entry per run to metrics_json_info.json here. None = off.

Where things are written

Path Written when Contents
<save_dir>/failed_downloads.jsonl Something failed The failure ledger
<save_dir>/failed_downloads.txt Something failed The failed URLs, one per line
<save_dir>/.<name>.machpart During a streamed download A partial body, kept for resuming; removed when finished or abandoned
~/.machyon/profiles.json After a run that downloaded something, with adaptive and warm_start on The concurrency learned per host
<metrics_dir>/metrics_json_info.json metrics_dir is set One summary entry per run
<log_dir>/machyon.log log_dir is set A rotating log