Skip to content

Commit c7f251c

Browse files
Merge branch 'main' into main
2 parents cc852fa + e44db6b commit c7f251c

File tree

51 files changed

+1871
-6114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1871
-6114
lines changed

.github/workflows/test-and-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }}
4848
TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }}
4949
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
50+
ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }}
5051
run: make cluster-test
5152

5253
- name: Verify docs generation

CHANGES.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,45 @@ twilio-python Changelog
33

44
Here you can see the full list of changes between each twilio-python release.
55

6+
[2025-04-07] Version 9.5.2
7+
--------------------------
8+
**Studio**
9+
- Add documentation for parent_step_sid field in Step resource
10+
11+
12+
[2025-03-20] Version 9.5.1
13+
--------------------------
14+
**Accounts**
15+
- Update Safelist API docs as part of prefix supoort
16+
17+
**Flex**
18+
- Removing `first_name`, `last_name`, and `friendly_name` from the Flex User API
19+
20+
**Messaging**
21+
- Add missing tests under transaction/phone_numbers and transaction/short_code
22+
23+
24+
[2025-03-11] Version 9.5.0
25+
--------------------------
26+
**Library - Feature**
27+
- [PR #850](https://github.com/twilio/twilio-python/pull/850): Update UPGRADE.md. Thanks to [@manisha1997](https://github.com/manisha1997)!
28+
29+
**Library - Fix**
30+
- [PR #847](https://github.com/twilio/twilio-python/pull/847): AssistantsBase import. Thanks to [@sbansla](https://github.com/sbansla)!
31+
32+
**Api**
33+
- Add the missing `emergency_enabled` field for `Address Service` endpoints
34+
35+
**Messaging**
36+
- Add missing enums for A2P and TF
37+
38+
**Numbers**
39+
- add missing enum values to hosted_number_order_status
40+
41+
**Twiml**
42+
- Convert Twiml Attribute `speechModel` of type enum to string **(breaking change)**
43+
44+
645
[2025-02-20] Version 9.4.6
746
--------------------------
847
**Library - Chore**

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ The library automatically handles paging for you. Collections, such as `calls` a
193193

194194
`list` eagerly fetches all records and returns them as a list, whereas `stream` returns an iterator and lazily retrieves pages of records as you iterate over the collection. You can also page manually using the `page` method.
195195

196+
`page_size` as a parameter is used to tell how many records should we get in every page and `limit` parameter is used to limit the max number of records we want to fetch.
197+
196198
#### Use the `list` method
197199

198200
```python
@@ -206,6 +208,21 @@ for sms in client.messages.list():
206208
print(sms.to)
207209
```
208210

211+
```python
212+
client.messages.list(limit=20, page_size=20)
213+
```
214+
This will make 1 call that will fetch 20 records from backend service.
215+
216+
```python
217+
client.messages.list(limit=20, page_size=10)
218+
```
219+
This will make 2 calls that will fetch 10 records each from backend service.
220+
221+
```python
222+
client.messages.list(limit=20, page_size=100)
223+
```
224+
This will make 1 call which will fetch 100 records but user will get only 20 records.
225+
209226
### Asynchronous API Requests
210227

211228
By default, the Twilio Client will make synchronous requests to the Twilio API. To allow for asynchronous, non-blocking requests, we've included an optional asynchronous HTTP client. When used with the Client and the accompanying `*_async` methods, requests made to the Twilio API will be performed asynchronously.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
setup(
1515
name="twilio",
16-
version="9.4.6",
16+
version="9.5.2",
1717
description="Twilio API client and TwiML generator",
1818
author="Twilio",
1919
help_center="https://www.twilio.com/help/contact",

tests/cluster/test_cluster.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def setUp(self):
1212
self.api_key = os.environ["TWILIO_API_KEY"]
1313
self.api_secret = os.environ["TWILIO_API_SECRET"]
1414
self.account_sid = os.environ["TWILIO_ACCOUNT_SID"]
15+
self.assistant_id = os.environ["ASSISTANT_ID"]
1516
self.client = Client(
1617
username=self.api_key,
1718
password=self.api_secret,
@@ -65,6 +66,11 @@ def test_list_available_numbers(self):
6566
self.assertIsNotNone(toll_free_numbers)
6667
self.assertEqual(len(toll_free_numbers), 2)
6768

69+
def test_fetch_assistant(self):
70+
assistant = self.client.assistants.v1.assistants(self.assistant_id).fetch()
71+
self.assertIsNotNone(assistant)
72+
self.assertEqual(assistant.account_sid, self.account_sid)
73+
6874
def test_calling_twiml_string(self):
6975
call = self.client.calls.create(
7076
to=self.to_number, from_=self.from_number, twiml=str(self.voice_twiml)

twilio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version_info__ = ("9", "4", "6")
1+
__version_info__ = ("9", "5", "2")
22
__version__ = ".".join(__version_info__)

twilio/rest/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from twilio.rest.insights import Insights
3030
from twilio.rest.intelligence import Intelligence
3131
from twilio.rest.ip_messaging import IpMessaging
32+
from twilio.rest.knowledge import Knowledge
3233
from twilio.rest.lookups import Lookups
3334
from twilio.rest.marketplace import Marketplace
3435
from twilio.rest.messaging import Messaging
@@ -142,6 +143,7 @@ def __init__(
142143
self._insights: Optional["Insights"] = None
143144
self._intelligence: Optional["Intelligence"] = None
144145
self._ip_messaging: Optional["IpMessaging"] = None
146+
self._knowledge: Optional["Knowledge"] = None
145147
self._lookups: Optional["Lookups"] = None
146148
self._marketplace: Optional["Marketplace"] = None
147149
self._messaging: Optional["Messaging"] = None
@@ -361,6 +363,19 @@ def ip_messaging(self) -> "IpMessaging":
361363
self._ip_messaging = IpMessaging(self)
362364
return self._ip_messaging
363365

366+
@property
367+
def knowledge(self) -> "Knowledge":
368+
"""
369+
Access the Knowledge Twilio Domain
370+
371+
:returns: Knowledge Twilio Domain
372+
"""
373+
if self._knowledge is None:
374+
from twilio.rest.knowledge import Knowledge
375+
376+
self._knowledge = Knowledge(self)
377+
return self._knowledge
378+
364379
@property
365380
def lookups(self) -> "Lookups":
366381
"""

twilio/rest/accounts/v1/safelist.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class SafelistInstance(InstanceResource):
2424
"""
2525
:ivar sid: The unique string that we created to identify the SafeList resource.
26-
:ivar phone_number: The phone number in SafeList.
26+
:ivar phone_number: The phone number or phone number 1k prefix in SafeList.
2727
"""
2828

2929
def __init__(self, version: Version, payload: Dict[str, Any]):
@@ -59,7 +59,7 @@ def create(self, phone_number: str) -> SafelistInstance:
5959
"""
6060
Create the SafelistInstance
6161
62-
:param phone_number: The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
62+
:param phone_number: The phone number or phone number 1k prefix to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
6363
6464
:returns: The created SafelistInstance
6565
"""
@@ -85,7 +85,7 @@ async def create_async(self, phone_number: str) -> SafelistInstance:
8585
"""
8686
Asynchronously create the SafelistInstance
8787
88-
:param phone_number: The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
88+
:param phone_number: The phone number or phone number 1k prefix to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
8989
9090
:returns: The created SafelistInstance
9191
"""
@@ -111,7 +111,7 @@ def delete(self, phone_number: Union[str, object] = values.unset) -> bool:
111111
"""
112112
Asynchronously delete the SafelistInstance
113113
114-
:param phone_number: The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
114+
:param phone_number: The phone number or phone number 1k prefix to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
115115
:returns: True if delete succeeds, False otherwise
116116
"""
117117
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
@@ -131,7 +131,7 @@ async def delete_async(
131131
"""
132132
Asynchronously delete the SafelistInstance
133133
134-
:param phone_number: The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
134+
:param phone_number: The phone number or phone number 1k prefix to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
135135
:returns: True if delete succeeds, False otherwise
136136
"""
137137
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
@@ -151,7 +151,7 @@ def fetch(
151151
"""
152152
Asynchronously fetch the SafelistInstance
153153
154-
:param phone_number: The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
154+
:param phone_number: The phone number or phone number 1k prefix to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
155155
:returns: The fetched SafelistInstance
156156
"""
157157
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
@@ -176,7 +176,7 @@ async def fetch_async(
176176
"""
177177
Asynchronously fetch the SafelistInstance
178178
179-
:param phone_number: The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
179+
:param phone_number: The phone number or phone number 1k prefix to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
180180
:returns: The fetched SafelistInstance
181181
"""
182182
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

twilio/rest/api/v2010/account/address/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ def stream(
619619
self,
620620
customer_name: Union[str, object] = values.unset,
621621
friendly_name: Union[str, object] = values.unset,
622+
emergency_enabled: Union[bool, object] = values.unset,
622623
iso_country: Union[str, object] = values.unset,
623624
limit: Optional[int] = None,
624625
page_size: Optional[int] = None,
@@ -631,6 +632,7 @@ def stream(
631632
632633
:param str customer_name: The `customer_name` of the Address resources to read.
633634
:param str friendly_name: The string that identifies the Address resources to read.
635+
:param bool emergency_enabled: Whether the address can be associated to a number for emergency calling.
634636
:param str iso_country: The ISO country code of the Address resources to read.
635637
:param limit: Upper limit for the number of records to return. stream()
636638
guarantees to never return more than limit. Default is no limit
@@ -645,6 +647,7 @@ def stream(
645647
page = self.page(
646648
customer_name=customer_name,
647649
friendly_name=friendly_name,
650+
emergency_enabled=emergency_enabled,
648651
iso_country=iso_country,
649652
page_size=limits["page_size"],
650653
)
@@ -655,6 +658,7 @@ async def stream_async(
655658
self,
656659
customer_name: Union[str, object] = values.unset,
657660
friendly_name: Union[str, object] = values.unset,
661+
emergency_enabled: Union[bool, object] = values.unset,
658662
iso_country: Union[str, object] = values.unset,
659663
limit: Optional[int] = None,
660664
page_size: Optional[int] = None,
@@ -667,6 +671,7 @@ async def stream_async(
667671
668672
:param str customer_name: The `customer_name` of the Address resources to read.
669673
:param str friendly_name: The string that identifies the Address resources to read.
674+
:param bool emergency_enabled: Whether the address can be associated to a number for emergency calling.
670675
:param str iso_country: The ISO country code of the Address resources to read.
671676
:param limit: Upper limit for the number of records to return. stream()
672677
guarantees to never return more than limit. Default is no limit
@@ -681,6 +686,7 @@ async def stream_async(
681686
page = await self.page_async(
682687
customer_name=customer_name,
683688
friendly_name=friendly_name,
689+
emergency_enabled=emergency_enabled,
684690
iso_country=iso_country,
685691
page_size=limits["page_size"],
686692
)
@@ -691,6 +697,7 @@ def list(
691697
self,
692698
customer_name: Union[str, object] = values.unset,
693699
friendly_name: Union[str, object] = values.unset,
700+
emergency_enabled: Union[bool, object] = values.unset,
694701
iso_country: Union[str, object] = values.unset,
695702
limit: Optional[int] = None,
696703
page_size: Optional[int] = None,
@@ -702,6 +709,7 @@ def list(
702709
703710
:param str customer_name: The `customer_name` of the Address resources to read.
704711
:param str friendly_name: The string that identifies the Address resources to read.
712+
:param bool emergency_enabled: Whether the address can be associated to a number for emergency calling.
705713
:param str iso_country: The ISO country code of the Address resources to read.
706714
:param limit: Upper limit for the number of records to return. list() guarantees
707715
never to return more than limit. Default is no limit
@@ -716,6 +724,7 @@ def list(
716724
self.stream(
717725
customer_name=customer_name,
718726
friendly_name=friendly_name,
727+
emergency_enabled=emergency_enabled,
719728
iso_country=iso_country,
720729
limit=limit,
721730
page_size=page_size,
@@ -726,6 +735,7 @@ async def list_async(
726735
self,
727736
customer_name: Union[str, object] = values.unset,
728737
friendly_name: Union[str, object] = values.unset,
738+
emergency_enabled: Union[bool, object] = values.unset,
729739
iso_country: Union[str, object] = values.unset,
730740
limit: Optional[int] = None,
731741
page_size: Optional[int] = None,
@@ -737,6 +747,7 @@ async def list_async(
737747
738748
:param str customer_name: The `customer_name` of the Address resources to read.
739749
:param str friendly_name: The string that identifies the Address resources to read.
750+
:param bool emergency_enabled: Whether the address can be associated to a number for emergency calling.
740751
:param str iso_country: The ISO country code of the Address resources to read.
741752
:param limit: Upper limit for the number of records to return. list() guarantees
742753
never to return more than limit. Default is no limit
@@ -752,6 +763,7 @@ async def list_async(
752763
async for record in await self.stream_async(
753764
customer_name=customer_name,
754765
friendly_name=friendly_name,
766+
emergency_enabled=emergency_enabled,
755767
iso_country=iso_country,
756768
limit=limit,
757769
page_size=page_size,
@@ -762,6 +774,7 @@ def page(
762774
self,
763775
customer_name: Union[str, object] = values.unset,
764776
friendly_name: Union[str, object] = values.unset,
777+
emergency_enabled: Union[bool, object] = values.unset,
765778
iso_country: Union[str, object] = values.unset,
766779
page_token: Union[str, object] = values.unset,
767780
page_number: Union[int, object] = values.unset,
@@ -773,6 +786,7 @@ def page(
773786
774787
:param customer_name: The `customer_name` of the Address resources to read.
775788
:param friendly_name: The string that identifies the Address resources to read.
789+
:param emergency_enabled: Whether the address can be associated to a number for emergency calling.
776790
:param iso_country: The ISO country code of the Address resources to read.
777791
:param page_token: PageToken provided by the API
778792
:param page_number: Page Number, this value is simply for client state
@@ -784,6 +798,7 @@ def page(
784798
{
785799
"CustomerName": customer_name,
786800
"FriendlyName": friendly_name,
801+
"EmergencyEnabled": serialize.boolean_to_string(emergency_enabled),
787802
"IsoCountry": iso_country,
788803
"PageToken": page_token,
789804
"Page": page_number,
@@ -804,6 +819,7 @@ async def page_async(
804819
self,
805820
customer_name: Union[str, object] = values.unset,
806821
friendly_name: Union[str, object] = values.unset,
822+
emergency_enabled: Union[bool, object] = values.unset,
807823
iso_country: Union[str, object] = values.unset,
808824
page_token: Union[str, object] = values.unset,
809825
page_number: Union[int, object] = values.unset,
@@ -815,6 +831,7 @@ async def page_async(
815831
816832
:param customer_name: The `customer_name` of the Address resources to read.
817833
:param friendly_name: The string that identifies the Address resources to read.
834+
:param emergency_enabled: Whether the address can be associated to a number for emergency calling.
818835
:param iso_country: The ISO country code of the Address resources to read.
819836
:param page_token: PageToken provided by the API
820837
:param page_number: Page Number, this value is simply for client state
@@ -826,6 +843,7 @@ async def page_async(
826843
{
827844
"CustomerName": customer_name,
828845
"FriendlyName": friendly_name,
846+
"EmergencyEnabled": serialize.boolean_to_string(emergency_enabled),
829847
"IsoCountry": iso_country,
830848
"PageToken": page_token,
831849
"Page": page_number,

twilio/rest/api/v2010/account/conference/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class UpdateStatus(object):
5151
:ivar date_updated: The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
5252
:ivar api_version: The API version used to create this conference.
5353
:ivar friendly_name: A string that you assigned to describe this conference room. Maximum length is 128 characters.
54-
:ivar region: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants.
54+
:ivar region: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants.
5555
:ivar sid: The unique, Twilio-provided string used to identify this Conference resource.
5656
:ivar status:
5757
:ivar uri: The URI of this resource, relative to `https://api.twilio.com`.

0 commit comments

Comments
 (0)