edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

EDGAR_ACCESS_MODE is documented with a timeout/connection/retry table, but nothing in the package reads it

Open mmitc opened this issue 2 months ago • 1 comments

Issue Type

  • [ ] Data Quality Issue (incorrect financial values, missing data)
  • [ ] XBRL Parsing Issue (statement rendering, concept mapping)
  • [ ] Filing Access Issue (download failures, attachment problems)
  • [ ] Performance Issue (slow operations, memory problems)
  • [ ] Compatibility Issue (platform/dependency conflicts)
  • [x] Documentation Issue (unclear instructions, missing examples)

Environment

EdgarTools Version: 5.58.0 Python Version: 3.14.3 Operating System: Windows 11

Bug Description

What you expected to happen: docs/configuration.md documents EDGAR_ACCESS_MODE (NORMAL, CAUTION, CRAWL) with a table of HTTP timeouts, connection limits and retry counts per mode, and recommends CAUTION or CRAWL for being a good SEC citizen. I expected setting EDGAR_ACCESS_MODE=CRAWL to change the client's timeout, connection count or retries.

What actually happened: Nothing changes. The variable is read — edgar/settings.py (lines 90-99) builds edgar_mode from it, and edgar/core.py and edgar/__init__.py re-export edgar_mode, CAUTION, CRAWL and NORMAL — but no module in the package reads edgar_mode or edgar_access_mode, and nothing reads the mode's fields. HTTP_MGR in edgar/httpclient.py is built from EDGAR_HTTP_TIMEOUT and EDGAR_RATE_LIMIT_PER_SEC alone. So the documented setting takes effect silently: it looks configured and does nothing.

Error message (if any):

none — that is the problem; the setting fails silently

Reproduction

grep -rn "EDGAR_ACCESS_MODE\|edgar_mode\b\|edgar_access_mode" edgar --include=*.py

At 5.58.0 this lists only edgar/settings.py (the read and the three assignments), edgar/core.py (two re-export lines) and edgar/__init__.py (one import line). docs/configuration.md names EDGAR_ACCESS_MODE seventeen times (lines 45-69, 316, 339, 391, 616-647, 673, 695, 731, 768 and 786).

Additional Context

Two ways to close this and I am happy to send a PR for either:

  1. Wire it: have get_http_mgr read edgar_mode.http_timeout / max_connections / retries (or whatever the mode objects carry) so the table becomes true.
  2. Drop it: remove the EDGAR_ACCESS_MODE section from docs/configuration.md and deprecate the exports, pointing readers at EDGAR_RATE_LIMIT_PER_SEC and EDGAR_HTTP_TIMEOUT, which do work.

Which do you prefer? A separate docs PR (coming) fixes three names in the same docs that no longer exist (set_rate_limit, enable_local_storage) and the submissions cache TTL; this one is kept apart because it is a design choice rather than a typo.

mmitc avatar Sep 12 '26 17:09 mmitc

Thanks for the careful writeup, and for separating the design question from the typo fixes.

Decision: drop it (your option 2). A PR would be very welcome.

The reasoning: EDGAR_RATE_LIMIT_PER_SEC is what actually protects you from breaching SEC limits, and it works today, so the stated purpose of the modes is already served. Two explicit numbers compose better than three opaque presets, and wiring retries and connection limits would be real work in client construction to reproduce, less precisely, what the two working settings already give you.

One thing worth knowing before you start, which isn't in your report. EdgarSettings.limits is broken independently of the wiring question:

@cached_property
def limits(self):
    return httpx.Limits(max_connections=default_max_connections)

It ignores self.max_connections and returns the module default, so NORMAL, CAUTION and CRAWL all report max_connections=10 despite declaring 10, 5 and 2. That would have made option 1 larger than it looks, and under option 2 the property just goes away with the rest.

Scope I'd suggest for the PR:

  1. Remove the EDGAR_ACCESS_MODE section and the per-mode table from docs/configuration.md, pointing readers at EDGAR_RATE_LIMIT_PER_SEC and EDGAR_HTTP_TIMEOUT.
  2. Emit a DeprecationWarning when EDGAR_ACCESS_MODE is set and on access to the edgar_mode / NORMAL / CAUTION / CRAWL exports, naming both replacements. Keep the exports working for now.
  3. A test asserting the warning fires and names the replacements.
  4. Drop EdgarSettings.limits along with the rest rather than repairing it.

The exports are public, so the removal itself lands in 6.0; this PR is the deprecation and the docs correction. A changelog fragment under changelog.d/ rather than an edit to CHANGELOG.md, please, and Fixes #1326 in the PR body.

Your separate docs PR for the stale names and the cache TTL is good to send whenever.

dgunning avatar Sep 17 '26 00:09 dgunning