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 Jul 6, 2024
2 parents 6204eae + 6324a1c commit 26fd590
Show file tree
Hide file tree
Showing 271 changed files with 3,002 additions and 1,409 deletions.
54 changes: 54 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,60 @@ twilio-python Changelog

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

[2024-07-02] Version 9.2.3
--------------------------
**Intelligence**
- Deprecate account flag api.twilio-intelligence.v2


[2024-06-27] Version 9.2.2
--------------------------
**Api**
- Add `transcription` resource

**Flex**
- Changed mount name for flex_team v2 api

**Intelligence**
- Add `X-Rate-Limit-Limit`, `X-Rate-Limit-Remaining`, and `X-Rate-Limit-Config` as Response Headers to Operator resources

**Numbers**
- Added include_constraints query parameter to the Regulations API

**Twiml**
- Add support for `<Transcription>` noun


[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.3",
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", "3")
__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
15 changes: 15 additions & 0 deletions twilio/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from twilio.rest.events import Events
from twilio.rest.flex_api import FlexApi
from twilio.rest.frontline_api import FrontlineApi
from twilio.rest.preview_iam import PreviewIam
from twilio.rest.insights import Insights
from twilio.rest.intelligence import Intelligence
from twilio.rest.ip_messaging import IpMessaging
Expand Down Expand Up @@ -131,6 +132,7 @@ def __init__(
self._events: Optional["Events"] = None
self._flex_api: Optional["FlexApi"] = None
self._frontline_api: Optional["FrontlineApi"] = None
self._preview_iam: Optional["PreviewIam"] = None
self._insights: Optional["Insights"] = None
self._intelligence: Optional["Intelligence"] = None
self._ip_messaging: Optional["IpMessaging"] = None
Expand Down Expand Up @@ -276,6 +278,19 @@ def frontline_api(self) -> "FrontlineApi":
self._frontline_api = FrontlineApi(self)
return self._frontline_api

@property
def preview_iam(self) -> "PreviewIam":
"""
Access the PreviewIam Twilio Domain
:returns: PreviewIam Twilio Domain
"""
if self._preview_iam is None:
from twilio.rest.preview_iam import PreviewIam

self._preview_iam = PreviewIam(self)
return self._preview_iam

@property
def insights(self) -> "Insights":
"""
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
Loading

0 comments on commit 26fd590

Please sign in to comment.