Skip to content

Commit

Permalink
Merge branch 'main' into oauth-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
manisha1997 authored Jun 25, 2024
2 parents 691071d + 6c7d08a commit ac7ec61
Show file tree
Hide file tree
Showing 266 changed files with 1,092 additions and 1,339 deletions.
30 changes: 30 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ twilio-python Changelog

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

[2024-06-21] Version 9.2.1
--------------------------
**Api**
- Add beta feature request managed cert


[2024-06-18] Version 9.2.0
--------------------------
**Library - Chore**
- [PR #796](https://github.com/twilio/twilio-python/pull/796): adding contentType in post and put. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)!

**Events**
- Add `status` and `documentation_url` to Event Types

**Lookups**
- Removed unused `fraud` lookups in V1 only to facilitate rest proxy migration

**Numbers**
- Add date_created field to the Get Port In Request API
- Rename the `status_last_time_updated_timestamp` field to `last_updated` in the Get Port In Phone Number API **(breaking change)**
- Add Rejection reason and rejection reason code to the Get Port In Phone Number API
- Remove the carrier information from the Portability API

**Proxy**
- Change property `type` from enum to ienum

**Trusthub**
- Add skipMessagingUseCase field in compliance_tollfree_inquiry.


[2024-06-06] Version 9.1.1
--------------------------
**Api**
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="twilio",
version="9.1.1",
version="9.2.1",
description="Twilio API client and TwiML generator",
author="Twilio",
help_center="https://www.twilio.com/help/contact",
Expand Down
2 changes: 1 addition & 1 deletion twilio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = ("9", "1", "1")
__version_info__ = ("9", "2", "1")
__version__ = ".".join(__version_info__)
2 changes: 1 addition & 1 deletion twilio/base/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def get_headers(

# Types, encodings, etc.
headers["Accept-Charset"] = "utf-8"
if method == "POST" and "Content-Type" not in headers:
if (method == "POST" or method == "PUT") and ("Content-Type" not in headers):
headers["Content-Type"] = "application/x-www-form-urlencoded"
if "Accept" not in headers:
headers["Accept"] = "application/json"
Expand Down
10 changes: 4 additions & 6 deletions twilio/rest/accounts/v1/credential/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,10 @@ def create(
"AccountSid": account_sid,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return AwsInstance(self._version, payload)
Expand Down Expand Up @@ -362,11 +361,10 @@ async def create_async(
"AccountSid": account_sid,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return AwsInstance(self._version, payload)
Expand Down
10 changes: 4 additions & 6 deletions twilio/rest/accounts/v1/credential/public_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,10 @@ def create(
"AccountSid": account_sid,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return PublicKeyInstance(self._version, payload)
Expand Down Expand Up @@ -366,11 +365,10 @@ async def create_async(
"AccountSid": account_sid,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return PublicKeyInstance(self._version, payload)
Expand Down
26 changes: 16 additions & 10 deletions twilio/rest/accounts/v1/safelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ def create(self, phone_number: str) -> SafelistInstance:
"PhoneNumber": phone_number,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return SafelistInstance(self._version, payload)
Expand All @@ -92,11 +91,10 @@ async def create_async(self, phone_number: str) -> SafelistInstance:
"PhoneNumber": phone_number,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return SafelistInstance(self._version, payload)
Expand All @@ -108,13 +106,16 @@ def delete(self, phone_number: Union[str, object] = values.unset) -> bool:
: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).
:returns: True if delete succeeds, False otherwise
"""
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

params = values.of(
{
"PhoneNumber": phone_number,
}
)
return self._version.delete(method="DELETE", uri=self._uri, params=params)
return self._version.delete(
method="DELETE", uri=self._uri, headers=headers, params=params
)

async def delete_async(
self, phone_number: Union[str, object] = values.unset
Expand All @@ -125,14 +126,15 @@ async def delete_async(
: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).
:returns: True if delete succeeds, False otherwise
"""
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

params = values.of(
{
"PhoneNumber": phone_number,
}
)
return await self._version.delete_async(
method="DELETE", uri=self._uri, params=params
method="DELETE", uri=self._uri, headers=headers, params=params
)

def fetch(
Expand All @@ -144,14 +146,17 @@ def fetch(
: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).
:returns: The fetched SafelistInstance
"""
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

params = values.of(
{
"PhoneNumber": phone_number,
}
)

payload = self._version.fetch(method="GET", uri=self._uri, params=params)
payload = self._version.fetch(
method="GET", uri=self._uri, headers=headers, params=params
)

return SafelistInstance(self._version, payload)

Expand All @@ -164,6 +169,7 @@ async def fetch_async(
: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).
:returns: The fetched SafelistInstance
"""
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

params = values.of(
{
Expand All @@ -172,7 +178,7 @@ async def fetch_async(
)

payload = await self._version.fetch_async(
method="GET", uri=self._uri, params=params
method="GET", uri=self._uri, headers=headers, params=params
)

return SafelistInstance(self._version, payload)
Expand Down
10 changes: 4 additions & 6 deletions twilio/rest/api/v2010/account/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,10 @@ def create(
"FriendlyName": friendly_name,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return AccountInstance(self._version, payload)
Expand All @@ -855,11 +854,10 @@ async def create_async(
"FriendlyName": friendly_name,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return AccountInstance(self._version, payload)
Expand Down
10 changes: 4 additions & 6 deletions twilio/rest/api/v2010/account/address/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,10 @@ def create(
"StreetSecondary": street_secondary,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return AddressInstance(
Expand Down Expand Up @@ -584,11 +583,10 @@ async def create_async(
"StreetSecondary": street_secondary,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return AddressInstance(
Expand Down
10 changes: 4 additions & 6 deletions twilio/rest/api/v2010/account/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,10 @@ def create(
),
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return ApplicationInstance(
Expand Down Expand Up @@ -713,11 +712,10 @@ async def create_async(
),
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return ApplicationInstance(
Expand Down
9 changes: 7 additions & 2 deletions twilio/rest/api/v2010/account/balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""

from typing import Any, Dict, Optional
from twilio.base import values

from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
Expand Down Expand Up @@ -72,8 +73,9 @@ def fetch(self) -> BalanceInstance:
:returns: The fetched BalanceInstance
"""
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.fetch(method="GET", uri=self._uri)
payload = self._version.fetch(method="GET", uri=self._uri, headers=headers)

return BalanceInstance(
self._version, payload, account_sid=self._solution["account_sid"]
Expand All @@ -86,8 +88,11 @@ async def fetch_async(self) -> BalanceInstance:
:returns: The fetched BalanceInstance
"""
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.fetch_async(method="GET", uri=self._uri)
payload = await self._version.fetch_async(
method="GET", uri=self._uri, headers=headers
)

return BalanceInstance(
self._version, payload, account_sid=self._solution["account_sid"]
Expand Down
12 changes: 5 additions & 7 deletions twilio/rest/api/v2010/account/call/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class UpdateStatus(object):
:ivar start_time: The start time of the call, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed.
:ivar end_time: The time the call ended, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully.
:ivar duration: The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls.
:ivar price: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available.
:ivar price: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. The price associated with a call only reflects the charge for connectivity. Charges for other call-related features such as Answering Machine Detection, Text-To-Speech, and SIP REFER are not included in this value.
:ivar price_unit: The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls.
:ivar direction: A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `<Dial>` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN.
:ivar answered_by: Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise.
Expand Down Expand Up @@ -807,11 +807,10 @@ def create(
"ApplicationSid": application_sid,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return CallInstance(
Expand Down Expand Up @@ -941,11 +940,10 @@ async def create_async(
"ApplicationSid": application_sid,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return CallInstance(
Expand Down
10 changes: 4 additions & 6 deletions twilio/rest/api/v2010/account/call/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,10 @@ def create(
"ValidCardTypes": valid_card_types,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return PaymentInstance(
Expand Down Expand Up @@ -440,11 +439,10 @@ async def create_async(
"ValidCardTypes": valid_card_types,
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST",
uri=self._uri,
data=data,
method="POST", uri=self._uri, data=data, headers=headers
)

return PaymentInstance(
Expand Down
Loading

0 comments on commit ac7ec61

Please sign in to comment.