feat: support APIFY_API_BASE_URL and APIFY_API_PUBLIC_BASE_URL env vars#948
Closed
Pijukatel wants to merge 2 commits into
Closed
feat: support APIFY_API_BASE_URL and APIFY_API_PUBLIC_BASE_URL env vars#948Pijukatel wants to merge 2 commits into
Pijukatel wants to merge 2 commits into
Conversation
What we're solving: the API base URL and public API base URL could only be set via constructor arguments, so pointing the client at a local, staging, or custom-port deployment meant threading arguments through every call site. How: both URLs now resolve as explicit argument > environment variable > default constant, applied identically in the sync and async clients and the with_custom_http_client path. Empty-string env values are treated as unset and the /v2 suffixing is unchanged, so setting nothing behaves exactly as before. Alternatives considered: a shared cross-repo config package, rejected as unnecessary for two values with a single construction site per client. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bXf84xVdv32VQAt916Ygj
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #948 +/- ##
==========================================
- Coverage 94.56% 94.52% -0.05%
==========================================
Files 48 48
Lines 5119 5133 +14
==========================================
+ Hits 4841 4852 +11
- Misses 278 281 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collapse the per-case sync/async base-URL resolution tests into pytest.mark.parametrize cases with descriptive ids, covering the same behavior (and a little more, since sync and async now share every case). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bXf84xVdv32VQAt916Ygj
This was referenced Jul 13, 2026
Closed
Contributor
Author
|
Close in favor of smaller CLI update: apify/apify-cli#1276 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The API base URL and public API base URL could only be set through constructor arguments, so pointing the client at a local platform, a staging deployment, or a custom host/port meant threading arguments through every construction site.
Both URLs now resolve as explicit argument > environment variable > default constant:
APIFY_API_BASE_URL→api_urlAPIFY_API_PUBLIC_BASE_URL→api_public_urlThe two variables are independent (each keeps its own default). Empty-string env values are treated as unset. The resolution is applied identically in the sync
ApifyClient, the asyncApifyClientAsync, and thewith_custom_http_clientpath, and the automatic/v2suffixing is unchanged. Setting nothing reproduces today's behavior exactly.Context
This is one of three sibling PRs applying the same env-var contract across the Apify clients and CLI (the CLI also adds
APIFY_CONSOLE_BASE_URL). Separate repos, no overlapping files: