Skip to content

feat: add subdivision code to proxy configuration#878

Merged
daniil-poletaev merged 5 commits intomasterfrom
feat/add-subdivision-code-to-proxy-configuration
Apr 29, 2026
Merged

feat: add subdivision code to proxy configuration#878
daniil-poletaev merged 5 commits intomasterfrom
feat/add-subdivision-code-to-proxy-configuration

Conversation

@daniil-poletaev
Copy link
Copy Markdown
Contributor

@daniil-poletaev daniil-poletaev commented Apr 24, 2026

This PR adds new variable subdivision_code to Apify proxy configuration. This variable is currently needed for US state targeting.

More context: https://apify.slack.com/archives/C010Q0FBYG3/p1776704073278519

Same PR in JS: apify/apify-sdk-js#592

@daniil-poletaev daniil-poletaev self-assigned this Apr 24, 2026
@daniil-poletaev daniil-poletaev added the adhoc Ad-hoc unplanned task added during the sprint. label Apr 24, 2026
@github-actions github-actions Bot added t-unblocking Issues with this label are in the ownership of the unblocking team. tested Temporary label used only programatically for some analytics. labels Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.01%. Comparing base (03e73d3) to head (479eecf).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #878      +/-   ##
==========================================
+ Coverage   86.96%   87.01%   +0.05%     
==========================================
  Files          48       48              
  Lines        2930     2942      +12     
==========================================
+ Hits         2548     2560      +12     
  Misses        382      382              
Flag Coverage Δ
e2e 37.72% <23.07%> (-0.06%) ⬇️
integration 59.04% <23.07%> (-0.14%) ⬇️
unit 75.76% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @daniil-poletaev , just a few nits from me (neither is blocking, address at your own discretion).

I'd rather wait for the Python folks for the final approve, therefore not approving (but it looks fine by me 👍 ).

Comment thread src/apify/_proxy_configuration.py Outdated
subdivision_code = str(subdivision_code)
_check(subdivision_code, label='subdivision_code', pattern=SUBDIVISION_CODE_REGEX)

if (proxy_urls or new_url_function or tiered_proxy_urls) and (groups or country_code or subdivision_code):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I suppose subdivision_code implies country_code at this point (because otherwise L158 would have raised an exception), so the condition can stay the same

Comment thread src/apify/_proxy_configuration.py Outdated
if (proxy_urls or new_url_function or tiered_proxy_urls) and (groups or country_code):
if subdivision_code:
if not country_code:
raise ValueError('Cannot set "subdivision_code" without "country_code".')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as apify/apify-sdk-js#592 (comment), i.e. I'd rather mention ProxyConfiguration somewhere in the error message.

Copy link
Copy Markdown
Contributor

@vdusek vdusek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also update the docs? This should be mentioned specifically in docs/02_concepts/05_proxy_management.mdx and docs/02_concepts/code/05_apify_proxy_config.py.

@daniil-poletaev daniil-poletaev requested a review from vdusek April 27, 2026 11:28
daniil-poletaev added a commit to apify/apify-sdk-js that referenced this pull request Apr 28, 2026
This PR adds new variable `subdivisionCode` and `apifyProxySubdivision`
to Apify proxy configuration. This variable is currently needed for US
state targeting.

More context:
https://apify.slack.com/archives/C010Q0FBYG3/p1776704073278519

Same PR in python: apify/apify-sdk-python#878
@daniil-poletaev daniil-poletaev merged commit b2e4006 into master Apr 29, 2026
31 checks passed
@daniil-poletaev daniil-poletaev deleted the feat/add-subdivision-code-to-proxy-configuration branch April 29, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-unblocking Issues with this label are in the ownership of the unblocking team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants