From 1cfbb88328e565b8eb8a0e8f7f78e91ea71ec825 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Wed, 21 Feb 2024 13:31:26 +0530 Subject: [PATCH 1/2] feat!: MVR release preparation --- CHANGES.md | 38 -------------------------------------- UPGRADE.md | 9 ++++----- 2 files changed, 4 insertions(+), 43 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6ad5394e4e..f3b7a49ddb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,44 +3,6 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. -[2024-02-09] Version 9.0.0-rc.2 -------------------------------- -**Library - Chore** -- [PR #765](https://github.com/twilio/twilio-python/pull/765): disables cluster test. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! - -**Flex** -- Adding `flex_instance_sid` to Flex Configuration - -**Insights** -- add flag to restrict access to unapid customers - -**Lookups** -- Remove `carrier` field from `sms_pumping_risk` and leave `carrier_risk_category` **(breaking change)** -- Remove carrier information from call forwarding package **(breaking change)** - -**Messaging** -- Add update instance endpoints to us_app_to_person api - -**Push** -- Migrated to new Push API V4 with Resilient Notification Delivery. - -**Trusthub** -- Add optional field NotificationEmail to the POST /v1/ComplianceInquiries/Customers/Initialize API - -**Verify** -- `Tags` property added again to Public Docs **(breaking change)** - - -[2024-01-08] Version 9.0.0-rc.1 -------------------------------- -**Library - Chore** -- [PR #743](https://github.com/twilio/twilio-python/pull/743): sync with main. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! - - -[2023-12-06] Version 9.0.0-rc.0 ---------------------------- -- Release Candidate preparation - [2023-12-14] Version 8.11.0 --------------------------- **Library - Chore** diff --git a/UPGRADE.md b/UPGRADE.md index 4bf1602c61..03c196bf5b 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -3,14 +3,13 @@ _`MAJOR` version bumps will have upgrade notes posted here._ -## [2023-12-06] 8.x.x to 9.x.x-rc.x - ---- +## [2024-02-20] 8.x.x to 9.x.x ### Overview -#### Twilio Python Helper Library’s major version 9.0.0-rc.x is now available. We ensured that you can upgrade to Python helper Library 9.0.0-rc.x version without any breaking changes +##### Twilio Python Helper Library’s major version 9.0.0 is now available. We ensured that you can upgrade to Python helper Library 9.0.0 version without any breaking changes of existing apis -Support for JSON payloads has been added in the request body +Behind the scenes Python Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages. +We're pleased to inform you that version 9.0.0 adds support for the application/json content type in the request body. ## [2023-04-05] 7.x.x to 8.x.x From c3cb1583ef8e1418a3a4b1c8edf35a41cf5bbe8c Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Wed, 21 Feb 2024 13:54:11 +0530 Subject: [PATCH 2/2] fix: added test for json data in http client --- tests/unit/http/test_http_client.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index e599aaaf00..8484e57b17 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -145,6 +145,32 @@ def test_last_request_last_response_exist(self): "testing-unicode: Ω≈ç√, 💩", self.client._test_only_last_response.text ) + def test_request_with_json(self): + self.request_mock.url = "https://api.twilio.com/" + self.request_mock.headers = {"Host": "other.twilio.com"} + + self.client.request( + "doesnt-matter-method", + "doesnt-matter-url", + {"params-value": "params-key"}, + {"json-key": "json-value"}, + {"Content-Type": "application/json"}, + ) + + self.assertIsNotNone(self.client._test_only_last_request) + self.assertEqual( + {"Content-Type": "application/json"}, + self.client._test_only_last_request.headers, + ) + + self.assertIsNotNone(self.client._test_only_last_response) + + if self.client._test_only_last_response is not None: + self.assertEqual(200, self.client._test_only_last_response.status_code) + self.assertEqual( + "testing-unicode: Ω≈ç√, 💩", self.client._test_only_last_response.text + ) + def test_last_response_empty_on_error(self): self.session_mock.send.side_effect = Exception("voltron")