Skip to content

feat: Added support for endpoint integration#201

Merged
OMpawar-21 merged 3 commits into
developmentfrom
enhc/DX-7270
Jun 8, 2026
Merged

feat: Added support for endpoint integration#201
OMpawar-21 merged 3 commits into
developmentfrom
enhc/DX-7270

Conversation

@OMpawar-21

Copy link
Copy Markdown

Summary

  • Replaces the hardcoded if/elif region→host chain in Stack._validate_stack() with a new Endpoint class that loads region data from a bundled regions.json (downloaded from artifacts.contentstack.com at install time, with in-memory cache and live-download fallback at runtime).
  • Adds a public get_contentstack_endpoint(region, service, omit_https) API usable outside of Stack initialization.
  • Bumps version to v2.6.0.

Changes

  • contentstack/endpoint.py — new Endpoint class with 3-tier resolution (memory → disk → CDN) and case-insensitive alias matching
  • contentstack/stack.py_validate_stack() and _setup_live_preview() use Endpoint instead of hardcoded map
  • contentstack/__init__.py — exports Endpoint + module-level get_contentstack_endpoint() proxy
  • contentstack/assets/regions.json — bundled region registry (7 regions)
  • scripts/download_regions.py — download script to refresh regions.json
  • setup.pypackage_data includes assets/regions.json
  • tests/test_endpoint.py — 52 unit tests (all regions, aliases, omit_https, error cases, Stack host resolution)
  • CHANGELOG.md — v2.6.0 entry

Backward compatibility

Explicit host= on Stack() still overrides region. Unknown regions fall back to the legacy {region}-cdn.contentstack.com pattern — no existing code breaks.

Test plan

  • python3 tests/test_endpoint.py -v — 52 tests pass (offline, no credentials needed)

@OMpawar-21 OMpawar-21 requested a review from sunil-lakshman June 7, 2026 10:17
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 12 25 ✅ Passed
🟡 Medium Severity 0 19 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 12
  • Medium without fixes: 19
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Updated release date for version 2.6.0 and added details about dynamic endpoint resolution and region-to-URL mapping.
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 12 25 ✅ Passed
🟡 Medium Severity 0 19 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 12
  • Medium without fixes: 19
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Comment thread scripts/download_regions.py Outdated
Removed the import error handling for the requests library and added the import statement at the top of the file.
@OMpawar-21 OMpawar-21 requested a review from sunil-lakshman June 8, 2026 07:34
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 12 25 ✅ Passed
🟡 Medium Severity 0 19 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 12
  • Medium without fixes: 19
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@OMpawar-21 OMpawar-21 marked this pull request as ready for review June 8, 2026 09:24
@OMpawar-21 OMpawar-21 requested a review from a team as a code owner June 8, 2026 09:24
@OMpawar-21 OMpawar-21 merged commit 04a04b6 into development Jun 8, 2026
9 checks passed
@OMpawar-21 OMpawar-21 deleted the enhc/DX-7270 branch June 8, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants