feat: Added support for endpoint integration#201
Conversation
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
✅ 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.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
✅ BUILD PASSED - All security checks passed |
Removed the import error handling for the requests library and added the import statement at the top of the file.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
✅ BUILD PASSED - All security checks passed |
Summary
if/elifregion→host chain inStack._validate_stack()with a newEndpointclass that loads region data from a bundledregions.json(downloaded fromartifacts.contentstack.comat install time, with in-memory cache and live-download fallback at runtime).get_contentstack_endpoint(region, service, omit_https)API usable outside of Stack initialization.v2.6.0.Changes
contentstack/endpoint.py— newEndpointclass with 3-tier resolution (memory → disk → CDN) and case-insensitive alias matchingcontentstack/stack.py—_validate_stack()and_setup_live_preview()useEndpointinstead of hardcoded mapcontentstack/__init__.py— exportsEndpoint+ module-levelget_contentstack_endpoint()proxycontentstack/assets/regions.json— bundled region registry (7 regions)scripts/download_regions.py— download script to refreshregions.jsonsetup.py—package_dataincludesassets/regions.jsontests/test_endpoint.py— 52 unit tests (all regions, aliases, omit_https, error cases, Stack host resolution)CHANGELOG.md— v2.6.0 entryBackward compatibility
Explicit
host=onStack()still overrides region. Unknown regions fall back to the legacy{region}-cdn.contentstack.compattern — no existing code breaks.Test plan
python3 tests/test_endpoint.py -v— 52 tests pass (offline, no credentials needed)