Incorrect type annotation for line_type_intelligence in PhoneNumberInstance (Lookup v2)
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 65/100
Research direction
Start in twilio/rest/lookups/v2/phone_number.py around lines 70–72, where PhoneNumberInstance declares line_type_intelligence. Compare the annotation with the linked Lookup v2 documentation and update it to represent the documented object shape. The issue is done when the field accepts the nested dictionary response without the reported type-checking error.
Written by the indexing model from the issue text.
Description
Description
The line_type_intelligence field in PhoneNumberInstance for the Lookup v2 API is incorrectly typed as Optional[str] when it should be Optional[Dict].
I mainly noticed this as my linter was failing the type check of one of my files because it thought the field was string.
Current Behavior
The type annotation for line_type_intelligence is:
https://github.com/twilio/twilio-python/blob/615fb812590f0481b75a11f89842874eb6858973/twilio/rest/lookups/v2/phone_number.py#L70-L72
Expected Behavior
According to the official Twilio documentation, line_type_intelligence should be typed as:
line_type_intelligence: Optional[Dict[str, Any]]
Evidence from Official Documentation
The Twilio Lookup v2 Line Type Intelligence documentation clearly shows that line_type_intelligence is an object (dictionary) containing the following properties:
mobile_country_code(string)mobile_network_code(string)carrier_name(string)type(string)error_code(nullable)
Example response from the official docs:
"line_type_intelligence": {
"error_code": null,
"mobile_country_code": "240",
"mobile_network_code": "38",
"carrier_name": "Twilio - SMS/MMS-SVR",
"type": "nonFixedVoip"
}
Impact
This incorrect typing can lead to:
- Type checking errors when accessing nested properties (e.g.,
phone_number.line_type_intelligence["type"])
If possible, I'd like to make this change and contribute.
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 815
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from twilio/twilio-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
twilio/twilio-python#932 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
twilio/twilio-python#930 ·
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
twilio/twilio-python#925 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
twilio/twilio-python#916 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
twilio/twilio-python#945 ·
All issues in twilio/twilio-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100