Skip to content

Commit 399bdc2

Browse files
chore: preview param change
1 parent 2aa9e67 commit 399bdc2

File tree

54 files changed

+400
-296
lines changed

Some content is hidden

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

54 files changed

+400
-296
lines changed

tests/unit/http/test_http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def test_str_excludes_authorization_header(self):
320320
data={"FriendlyName": "My New Account"},
321321
headers={
322322
"Authorization": "Bearer secret-token",
323-
"X-Custom-Header": "Value"
323+
"X-Custom-Header": "Value",
324324
},
325325
)
326326
expected = (

twilio/http/request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ def __str__(self) -> str:
7171
headers = ""
7272
if self.headers and self.headers != Match.ANY:
7373
headers = "\n{}".format(
74-
"\n".join(' -H "{}: {}"'.format(k, v) for k, v in self.headers.items() if k.lower() != "authorization")
74+
"\n".join(
75+
' -H "{}: {}"'.format(k, v)
76+
for k, v in self.headers.items()
77+
if k.lower() != "authorization"
78+
)
7579
)
7680

7781
return "{method} {url}{params}{data}{headers}".format(

twilio/rest/accounts/v1/secondary_auth_token.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,15 @@ def create(self) -> SecondaryAuthTokenInstance:
124124
125125
:returns: The created SecondaryAuthTokenInstance
126126
"""
127+
127128
data = values.of({})
129+
headers = values.of({})
128130

129-
payload = self._version.create(method="POST", uri=self._uri, data=data)
131+
headers["Accept"] = "application/json"
132+
133+
payload = self._version.create(
134+
method="POST", uri=self._uri, data=data, headers=headers
135+
)
130136

131137
return SecondaryAuthTokenInstance(self._version, payload)
132138

@@ -137,10 +143,14 @@ async def create_async(self) -> SecondaryAuthTokenInstance:
137143
138144
:returns: The created SecondaryAuthTokenInstance
139145
"""
146+
140147
data = values.of({})
148+
headers = values.of({})
149+
150+
headers["Accept"] = "application/json"
141151

142152
payload = await self._version.create_async(
143-
method="POST", uri=self._uri, data=data
153+
method="POST", uri=self._uri, data=data, headers=headers
144154
)
145155

146156
return SecondaryAuthTokenInstance(self._version, payload)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def fetch(
258258
:returns: The fetched RecordingInstance
259259
"""
260260

261-
data = values.of(
261+
params = values.of(
262262
{
263263
"IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted),
264264
}
@@ -269,7 +269,7 @@ def fetch(
269269
headers["Accept"] = "application/json"
270270

271271
payload = self._version.fetch(
272-
method="GET", uri=self._uri, params=data, headers=headers
272+
method="GET", uri=self._uri, params=params, headers=headers
273273
)
274274

275275
return RecordingInstance(
@@ -290,7 +290,7 @@ async def fetch_async(
290290
:returns: The fetched RecordingInstance
291291
"""
292292

293-
data = values.of(
293+
params = values.of(
294294
{
295295
"IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted),
296296
}
@@ -301,7 +301,7 @@ async def fetch_async(
301301
headers["Accept"] = "application/json"
302302

303303
payload = await self._version.fetch_async(
304-
method="GET", uri=self._uri, params=data, headers=headers
304+
method="GET", uri=self._uri, params=params, headers=headers
305305
)
306306

307307
return RecordingInstance(

twilio/rest/assistants/v1/assistant/assistants_knowledge.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,13 @@ def create(self) -> AssistantsKnowledgeInstance:
158158
159159
:returns: The created AssistantsKnowledgeInstance
160160
"""
161+
161162
data = values.of({})
163+
headers = values.of({})
162164

163-
payload = self._version.create(method="POST", uri=self._uri, data=data)
165+
payload = self._version.create(
166+
method="POST", uri=self._uri, data=data, headers=headers
167+
)
164168

165169
return AssistantsKnowledgeInstance(
166170
self._version,
@@ -176,10 +180,12 @@ async def create_async(self) -> AssistantsKnowledgeInstance:
176180
177181
:returns: The created AssistantsKnowledgeInstance
178182
"""
183+
179184
data = values.of({})
185+
headers = values.of({})
180186

181187
payload = await self._version.create_async(
182-
method="POST", uri=self._uri, data=data
188+
method="POST", uri=self._uri, data=data, headers=headers
183189
)
184190

185191
return AssistantsKnowledgeInstance(

twilio/rest/assistants/v1/assistant/assistants_tool.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,13 @@ def create(self) -> AssistantsToolInstance:
156156
157157
:returns: The created AssistantsToolInstance
158158
"""
159+
159160
data = values.of({})
161+
headers = values.of({})
160162

161-
payload = self._version.create(method="POST", uri=self._uri, data=data)
163+
payload = self._version.create(
164+
method="POST", uri=self._uri, data=data, headers=headers
165+
)
162166

163167
return AssistantsToolInstance(
164168
self._version,
@@ -174,10 +178,12 @@ async def create_async(self) -> AssistantsToolInstance:
174178
175179
:returns: The created AssistantsToolInstance
176180
"""
181+
177182
data = values.of({})
183+
headers = values.of({})
178184

179185
payload = await self._version.create_async(
180-
method="POST", uri=self._uri, data=data
186+
method="POST", uri=self._uri, data=data, headers=headers
181187
)
182188

183189
return AssistantsToolInstance(

twilio/rest/flex_api/v1/configuration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def fetch(
298298
:returns: The fetched ConfigurationInstance
299299
"""
300300

301-
data = values.of(
301+
params = values.of(
302302
{
303303
"UiVersion": ui_version,
304304
}
@@ -309,7 +309,7 @@ def fetch(
309309
headers["Accept"] = "application/json"
310310

311311
payload = self._version.fetch(
312-
method="GET", uri=self._uri, params=data, headers=headers
312+
method="GET", uri=self._uri, params=params, headers=headers
313313
)
314314

315315
return ConfigurationInstance(
@@ -328,7 +328,7 @@ async def fetch_async(
328328
:returns: The fetched ConfigurationInstance
329329
"""
330330

331-
data = values.of(
331+
params = values.of(
332332
{
333333
"UiVersion": ui_version,
334334
}
@@ -339,7 +339,7 @@ async def fetch_async(
339339
headers["Accept"] = "application/json"
340340

341341
payload = await self._version.fetch_async(
342-
method="GET", uri=self._uri, params=data, headers=headers
342+
method="GET", uri=self._uri, params=params, headers=headers
343343
)
344344

345345
return ConfigurationInstance(

twilio/rest/flex_api/v1/insights_questionnaires.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -258,19 +258,17 @@ def fetch(
258258
:returns: The fetched InsightsQuestionnairesInstance
259259
"""
260260

261-
data = values.of(
262-
{
263-
"Authorization": authorization,
264-
}
265-
)
266-
267261
headers = values.of({})
268262

263+
if not (
264+
authorization is values.unset
265+
or (isinstance(authorization, str) and not authorization)
266+
):
267+
headers["Authorization"] = authorization
268+
269269
headers["Accept"] = "application/json"
270270

271-
payload = self._version.fetch(
272-
method="GET", uri=self._uri, params=data, headers=headers
273-
)
271+
payload = self._version.fetch(method="GET", uri=self._uri, headers=headers)
274272

275273
return InsightsQuestionnairesInstance(
276274
self._version,
@@ -289,18 +287,18 @@ async def fetch_async(
289287
:returns: The fetched InsightsQuestionnairesInstance
290288
"""
291289

292-
data = values.of(
293-
{
294-
"Authorization": authorization,
295-
}
296-
)
297-
298290
headers = values.of({})
299291

292+
if not (
293+
authorization is values.unset
294+
or (isinstance(authorization, str) and not authorization)
295+
):
296+
headers["Authorization"] = authorization
297+
300298
headers["Accept"] = "application/json"
301299

302300
payload = await self._version.fetch_async(
303-
method="GET", uri=self._uri, params=data, headers=headers
301+
method="GET", uri=self._uri, headers=headers
304302
)
305303

306304
return InsightsQuestionnairesInstance(

twilio/rest/flex_api/v1/insights_session.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,21 @@ def create(
114114
115115
:returns: The created InsightsSessionInstance
116116
"""
117-
data = values.of(
118-
{
119-
"Authorization": authorization,
120-
}
121-
)
122117

123-
payload = self._version.create(method="POST", uri=self._uri, data=data)
118+
data = values.of({})
119+
headers = values.of({})
120+
121+
if not (
122+
authorization is values.unset
123+
or (isinstance(authorization, str) and not authorization)
124+
):
125+
headers["Authorization"] = authorization
126+
127+
headers["Accept"] = "application/json"
128+
129+
payload = self._version.create(
130+
method="POST", uri=self._uri, data=data, headers=headers
131+
)
124132

125133
return InsightsSessionInstance(self._version, payload)
126134

@@ -134,14 +142,20 @@ async def create_async(
134142
135143
:returns: The created InsightsSessionInstance
136144
"""
137-
data = values.of(
138-
{
139-
"Authorization": authorization,
140-
}
141-
)
145+
146+
data = values.of({})
147+
headers = values.of({})
148+
149+
if not (
150+
authorization is values.unset
151+
or (isinstance(authorization, str) and not authorization)
152+
):
153+
headers["Authorization"] = authorization
154+
155+
headers["Accept"] = "application/json"
142156

143157
payload = await self._version.create_async(
144-
method="POST", uri=self._uri, data=data
158+
method="POST", uri=self._uri, data=data, headers=headers
145159
)
146160

147161
return InsightsSessionInstance(self._version, payload)

twilio/rest/flex_api/v1/insights_user_roles.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,17 @@ def fetch(
109109
:returns: The fetched InsightsUserRolesInstance
110110
"""
111111

112-
data = values.of(
113-
{
114-
"Authorization": authorization,
115-
}
116-
)
117-
118112
headers = values.of({})
119113

114+
if not (
115+
authorization is values.unset
116+
or (isinstance(authorization, str) and not authorization)
117+
):
118+
headers["Authorization"] = authorization
119+
120120
headers["Accept"] = "application/json"
121121

122-
payload = self._version.fetch(
123-
method="GET", uri=self._uri, params=data, headers=headers
124-
)
122+
payload = self._version.fetch(method="GET", uri=self._uri, headers=headers)
125123

126124
return InsightsUserRolesInstance(
127125
self._version,
@@ -139,18 +137,18 @@ async def fetch_async(
139137
:returns: The fetched InsightsUserRolesInstance
140138
"""
141139

142-
data = values.of(
143-
{
144-
"Authorization": authorization,
145-
}
146-
)
147-
148140
headers = values.of({})
149141

142+
if not (
143+
authorization is values.unset
144+
or (isinstance(authorization, str) and not authorization)
145+
):
146+
headers["Authorization"] = authorization
147+
150148
headers["Accept"] = "application/json"
151149

152150
payload = await self._version.fetch_async(
153-
method="GET", uri=self._uri, params=data, headers=headers
151+
method="GET", uri=self._uri, headers=headers
154152
)
155153

156154
return InsightsUserRolesInstance(

0 commit comments

Comments
 (0)