Skip to content

Expose request statistics on ApifyClient #1175

Description

@vdusek

ApifyClient keeps its counters in a private _statistics attribute (_apify_client.py#L170) and hands it only to the default ImpitHttpClient (#L284). with_custom_http_client sets _http_client and leaves _statistics alone (#L257-L261), so with a custom client the root object's counters stay at zero while the HTTP client counts into its own ClientStatistics (_base.py#L152). ClientStatistics is not exported either (_statistics.py), so there is no supported way to read calls, requests, or rate-limit errors.

The JS client has a public client.stats (apify_client.ts#L120-L124) and points it at the custom HTTP client's stats when one is assigned (#L231-L235). Statistics is exported (statistics.ts).

Expected behavior

A public read-only statistics property on ApifyClient and ApifyClientAsync that returns the statistics of the HTTP client actually in use, custom or default, with ClientStatistics exported from apify_client.

✍️ Drafted by Claude Code

Activity

  1. added
    enhancementNew feature or request.
    t-toolingIssues with this label are in the ownership of the tooling team.
    on Oct 30, 2026
  2. added theissue type on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions