twilio / twilio/twilio-python

[BUG] Regulatory Compliance API uses deprecated `numbers.ie1.twilio.com` hostname causing SSL certificate mismatch when `region='ie1'`

Open
#924 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Python
Stars
2.1k
Forks
815
Avg merge
2d 13h
Merged PRs (30d)
2

Description

Describe the bug

When initializing the Twilio client with region='ie1', the Regulatory Compliance API (numbers.v2.regulatory_compliance) resolves to https://numbers.ie1.twilio.com. However, this hostname is no longer present in the SSL certificate's SANs, causing SSLCertVerificationError: certificate verify failed: Hostname mismatch.

Code snippet
from twilio.rest import Client

client = Client(account_sid, auth_token, region='ie1')
# This hits https://numbers.ie1.twilio.com and fails SSL verification
regulations = client.numbers.v2.regulatory_compliance.regulations.list()
Actual behavior
SSLError: HTTPSConnectionPool(host='numbers.ie1.twilio.com', port=443): 
Max retries exceeded with url: /v2/RegulatoryCompliance/Regulations...
Caused by SSLError(SSLCertVerificationError(1, 
"[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, 
certificate is not valid for 'numbers.ie1.twilio.com'"))
Expected behavior

The SDK should route to the new localized domain pattern or at minimum use a hostname with a valid certificate.

twilio-python version

9.10.4

Python version

3.11.9

Logs or error messages

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Client initialization using region='ie1' and trace how numbers.v2.regulatory_compliance builds its request hostname. Confirm the failing URL and determine the supported localized domain pattern, then add a regression test for this resource and verify that the resulting hostname matches a valid certificate.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.