Skip to content

Commit 51bb4eb

Browse files
authored
Merge branch 'main' into patch-1
2 parents bf17844 + ce65814 commit 51bb4eb

File tree

24 files changed

+1585
-109
lines changed

24 files changed

+1585
-109
lines changed

CHANGES.md

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

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

6+
[2025-05-13] Version 9.6.1
7+
--------------------------
8+
**Accounts**
9+
- Changes to add date_of_consent param in Bulk Consent API
10+
11+
**Api**
12+
- Change `friendly_name`, `date_created` and `date_updated` properties to type `string`.
13+
14+
**Twiml**
15+
- Update twiml definition for `<ConversationRelay>` and `<Assistant>`
16+
17+
18+
[2025-05-05] Version 9.6.0
19+
--------------------------
20+
**Library - Fix**
21+
- [PR #848](https://github.com/twilio/twilio-python/pull/848): Timezone changes in token_auth_strategy.py. Thanks to [@Pablo2113](https://github.com/Pablo2113)!
22+
- [PR #853](https://github.com/twilio/twilio-python/pull/853): Fix deprecated/invalid config in `setup.cfg`. Thanks to [@abravalheri](https://github.com/abravalheri)!
23+
24+
**Library - Chore**
25+
- [PR #858](https://github.com/twilio/twilio-python/pull/858): fix oauth examples. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)!
26+
27+
**Library - Docs**
28+
- [PR #855](https://github.com/twilio/twilio-python/pull/855): update pagination usage in README.md. Thanks to [@manisha1997](https://github.com/manisha1997)!
29+
30+
**Api**
31+
- Add `response_key` for `Usage Triggers` fetch endpoint.
32+
33+
**Flex**
34+
- Add Update Interaction API
35+
- Adding `webhook_ttid` as optional parameter in Interactions API
36+
37+
**Serverless**
38+
- Add node22 as a valid Build runtime
39+
- Add node20 as a valid Build runtime
40+
41+
**Video**
42+
- removed `transcribe_participants_on_connect` and `transcriptions_configuration` from the room resource **(breaking change)**
43+
- Added `transcribe_participants_on_connect` and `transcriptions_configuration` to the room resource
44+
45+
646
[2025-04-07] Version 9.5.2
747
--------------------------
848
**Studio**

examples/organization_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ def example():
1616
"""
1717
Some example usage of using organization resources
1818
"""
19-
self.client = Client(
19+
client = Client(
2020
account_sid=ACCOUNT_SID,
2121
credential_provider=OrgsCredentialProvider(CLIENT_ID, CLIENT_SECRET),
2222
)
2323

24-
accounts = self.client.preview_iam.organization(
24+
accounts = client.preview_iam.organization(
2525
organization_sid=ORGS_SID
2626
).accounts.stream()
2727
for record in accounts:

examples/public_oauth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ def example():
1717
"""
1818
Some example usage of message resources.
1919
"""
20-
self.client = Client(
20+
client = Client(
2121
account_sid=ACCOUNT_SID,
2222
credential_provider=ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET),
2323
)
2424

25-
msg = self.client.messages.create(
25+
msg = client.messages.create(
2626
to=self.to_number, from_=self.from_number, body="hello world"
2727
)
2828

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
universal = 1
33

44
[metadata]
5-
description-file = README.md
5+
long_description = file: README.md
66
license = MIT
77

88
[flake8]

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.5.2",
16+
version="9.6.1",
1717
description="Twilio API client and TwiML generator",
1818
author="Twilio",
1919
help_center="https://www.twilio.com/help/contact",

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", "5", "2")
1+
__version_info__ = ("9", "6", "1")
22
__version__ = ".".join(__version_info__)

twilio/auth_strategy/token_auth_strategy.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import jwt
22
import threading
33
import logging
4-
from datetime import datetime
4+
from datetime import datetime, timezone
55

66
from twilio.auth_strategy.auth_type import AuthType
77
from twilio.auth_strategy.auth_strategy import AuthStrategy
@@ -43,8 +43,10 @@ def is_token_expired(self, token):
4343
if exp is None:
4444
return True # No expiration time present, consider it expired
4545

46-
# Check if the expiration time has passed
47-
return datetime.fromtimestamp(exp) < datetime.utcnow()
46+
# Check if the expiration time has passed by using time-zone
47+
return datetime.fromtimestamp(exp, tz=timezone.utc) < datetime.now(
48+
timezone.utc
49+
)
4850

4951
except jwt.DecodeError:
5052
return True # Token is invalid

twilio/rest/accounts/v1/bulk_consents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def create(self, items: List[object]) -> BulkConsentsInstance:
5757
"""
5858
Create the BulkConsentsInstance
5959
60-
:param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`].
60+
:param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]; `date_of_consent`, an optional datetime string field in ISO-8601 format that captures the exact date and time when the user gave or revoked consent. If not provided, it will be empty.
6161
6262
:returns: The created BulkConsentsInstance
6363
"""
@@ -83,7 +83,7 @@ async def create_async(self, items: List[object]) -> BulkConsentsInstance:
8383
"""
8484
Asynchronously create the BulkConsentsInstance
8585
86-
:param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`].
86+
:param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]; `date_of_consent`, an optional datetime string field in ISO-8601 format that captures the exact date and time when the user gave or revoked consent. If not provided, it will be empty.
8787
8888
:returns: The created BulkConsentsInstance
8989
"""

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
Do not edit the class manually.
1313
"""
1414

15-
from datetime import datetime
1615
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
17-
from twilio.base import deserialize, values
16+
from twilio.base import values
1817

1918
from twilio.base.instance_resource import InstanceResource
2019
from twilio.base.list_resource import ListResource
@@ -51,7 +50,7 @@ class EmergencyStatus(object):
5150
:ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`.
5251
:ivar sms_url: The URL we call when the phone number receives an incoming SMS message.
5352
:ivar address_requirements:
54-
:ivar capabilities: The set of Boolean properties that indicates whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`.
53+
:ivar capabilities:
5554
:ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application.
5655
:ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`.
5756
:ivar api_version: The API version used to start a new TwiML session.
@@ -83,20 +82,16 @@ def __init__(
8382
self.voice_caller_id_lookup: Optional[bool] = payload.get(
8483
"voice_caller_id_lookup"
8584
)
86-
self.date_created: Optional[datetime] = deserialize.rfc2822_datetime(
87-
payload.get("date_created")
88-
)
89-
self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime(
90-
payload.get("date_updated")
91-
)
85+
self.date_created: Optional[str] = payload.get("date_created")
86+
self.date_updated: Optional[str] = payload.get("date_updated")
9287
self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method")
9388
self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url")
9489
self.sms_method: Optional[str] = payload.get("sms_method")
9590
self.sms_url: Optional[str] = payload.get("sms_url")
9691
self.address_requirements: Optional[
9792
"DependentPhoneNumberInstance.AddressRequirement"
9893
] = payload.get("address_requirements")
99-
self.capabilities: Optional[Dict[str, object]] = payload.get("capabilities")
94+
self.capabilities: Optional[str] = payload.get("capabilities")
10095
self.status_callback: Optional[str] = payload.get("status_callback")
10196
self.status_callback_method: Optional[str] = payload.get(
10297
"status_callback_method"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def create(
769769
:param status_callback: The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
770770
:param status_callback_event: The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored.
771771
:param status_callback_method: The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
772-
:param send_digits: A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
772+
:param send_digits: The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (`0`-`9`), '`A`', '`B`', '`C`', '`D`', '`#`', and '`*`'. You can also use '`w`' to insert a half-second pause and '`W`' to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to `W1234#`. Be sure to URL-encode this string because the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
773773
:param timeout: The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail.
774774
:param record: Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL.
775775
:param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call.
@@ -906,7 +906,7 @@ async def create_async(
906906
:param status_callback: The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
907907
:param status_callback_event: The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored.
908908
:param status_callback_method: The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
909-
:param send_digits: A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
909+
:param send_digits: The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (`0`-`9`), '`A`', '`B`', '`C`', '`D`', '`#`', and '`*`'. You can also use '`w`' to insert a half-second pause and '`W`' to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to `W1234#`. Be sure to URL-encode this string because the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
910910
:param timeout: The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail.
911911
:param record: Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL.
912912
:param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call.

0 commit comments

Comments
 (0)