-
Notifications
You must be signed in to change notification settings - Fork 797
fix: Regional API domain processing #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR attempts to introduce regional API domain processing by adding a region_mappings dictionary and deprecating the edge parameter in favor of region. However, the implementation has several critical issues that will break existing functionality and violate the documented API contract.
Key changes attempted:
- Added
region_mappingsdictionary to map region codes (e.g., "au1") to edge names (e.g., "sydney") - Added deprecation warning for the
edgeparameter - Modified edge initialization logic to automatically derive edge from region
- Added test for deprecation warning
- Updated test cases to use mapped region values
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| twilio/base/client_base.py | Adds region-to-edge mapping dictionary, deprecation warning for edge parameter, and modified initialization logic (contains critical bugs) |
| tests/unit/rest/test_client.py | Adds deprecation warning test and updates test values to use region codes (contains unused import) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
twilio/base/client_base.py
Outdated
| "`edge` is deprecated and will be removed in a future version. Use `region` instead.", | ||
| DeprecationWarning | ||
| ) | ||
| self.edge = (self.region_mappings[region] if region is not None else "") or edge or environment.get("TWILIO_EDGE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If region and edge both are provided, it will default to the edge specified in our mapping. Instead, it should give priority to the edge provided by the customer
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
tiwarishubham635
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|



Fixes
Set Deprecation warning for edge

Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.