@@ -50,6 +50,12 @@ def response(self) -> Response | Exception:
50
50
"""
51
51
return self ._response
52
52
53
+ # Note that TransportRequest (and TransportResponse below) aren't resolved types,
54
+ # but rather TypeVars. This is very important, because in the actual Interceptor
55
+ # interface class these are sometimes typed as None rather than, say, HttpRequest.
56
+ # That lets us use the type system to tell people when something will be set and
57
+ # when it will not be set without leaking nullability into the cases where the
58
+ # property will ALWAYS be set.
53
59
@property
54
60
def transport_request (self ) -> TransportRequest :
55
61
"""Retrieve the transmittable request for the operation being invoked.
@@ -146,15 +152,15 @@ def modify_before_serialization(
146
152
self , context : InterceptorContext [Request , None , None , None ]
147
153
) -> Request :
148
154
"""
149
- A hook called before the request is marshalled into a transport message .
155
+ A hook called before the request is serialized into a transport request .
150
156
This method has the ability to modify and return a new request of the
151
157
same type.
152
158
153
159
This will ALWAYS be called once per execution, except when a failure occurs
154
160
earlier in the request pipeline.
155
161
156
162
The `request` of the context will always be available. This `request` may have
157
- been modified by earlier `modify_before_serializtion ` hooks, and may be
163
+ been modified by earlier `modify_before_serialization ` hooks, and may be
158
164
modified further by later hooks. Other static properites will be None.
159
165
160
166
If exceptions are thrown by this hook, execution will jump to
@@ -169,7 +175,7 @@ def read_before_serialization(
169
175
self , context : InterceptorContext [Request , None , None , None ]
170
176
) -> None :
171
177
"""
172
- A hook called before the input message is marshalled into a transport message .
178
+ A hook called before the input message is serialized into a transport request .
173
179
174
180
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
175
181
or `transport_response` in this hook.
@@ -191,15 +197,15 @@ def read_after_serialization(
191
197
self , context : InterceptorContext [Request , None , TransportRequest , None ]
192
198
) -> None :
193
199
"""
194
- A hook called after the input message is marshalled into a transport message .
200
+ A hook called after the input message is serialized into a transport request .
195
201
196
202
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
197
203
or `transport_response` in this hook.
198
204
199
205
This will always be called once per execution, except when a failure occurs
200
- earlier in the request pipeline. The duration between invocation of this hook
201
- and `read_before_serialization` is very close to the amount of time spent
202
- marshalling the request.
206
+ earlier in the request pipeline. The duration between
207
+ `read_before_serialization` and the invocation of this hook is very close to
208
+ the amount of time spent serializing the request.
203
209
204
210
The `request` and `transport_request` of the context will always be available.
205
211
Other static properties will be None.
@@ -231,8 +237,8 @@ def read_before_attempt(
231
237
self , context : InterceptorContext [Request , None , TransportRequest , None ]
232
238
) -> None :
233
239
"""
234
- A hook called before each attempt at sending the transmission request message
235
- to the service.
240
+ A hook called before each attempt at sending the transport request to the
241
+ service.
236
242
237
243
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
238
244
or `transport_response` in this hook.
@@ -258,9 +264,8 @@ def modify_before_signing(
258
264
self , context : InterceptorContext [Request , None , TransportRequest , None ]
259
265
) -> TransportRequest :
260
266
"""
261
- A hook called before the transport request message is signed. This method has
262
- the ability to modify and return a new transport request message of the same
263
- type.
267
+ A hook called before the transport request is signed. This method has the
268
+ ability to modify and return a new transport request of the same type.
264
269
265
270
This will always be called once per attempt, except when a failure occurs
266
271
earlier in the request pipeline. This method will be called multiple times in
@@ -284,7 +289,7 @@ def read_before_signing(
284
289
self , context : InterceptorContext [Request , None , TransportRequest , None ]
285
290
) -> None :
286
291
"""
287
- A hook called before the transport request message is signed.
292
+ A hook called before the transport request is signed.
288
293
289
294
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
290
295
or `transport_response` in this hook.
@@ -309,15 +314,15 @@ def read_after_signing(
309
314
self , context : InterceptorContext [Request , None , TransportRequest , None ]
310
315
) -> None :
311
316
"""
312
- A hook called after the transport request message is signed.
317
+ A hook called after the transport request is signed.
313
318
314
319
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
315
320
or `transport_response` in this hook.
316
321
317
322
This will always be called once per attempt, except when a failure occurs
318
323
earlier in the request pipeline. This method may be called multiple times in
319
- the event of retries. The duration between invocation of this hook and
320
- `read_before_signing` is very close to the amount of time spent signing the
324
+ the event of retries. The duration between `read_before_signing` and the
325
+ invocation of this hook is very close to the amount of time spent signing the
321
326
request.
322
327
323
328
The `request` and `transport_request` of the context will always be available.
@@ -334,8 +339,8 @@ def modify_before_transmit(
334
339
self , context : InterceptorContext [Request , None , TransportRequest , None ]
335
340
) -> TransportRequest :
336
341
"""
337
- A hook called before the transport request message is sent to the service. This
338
- method has the ability to modify and return a new transport request message of
342
+ A hook called before the transport request is sent to the service. This
343
+ method has the ability to modify and return a new transport request of
339
344
the same type.
340
345
341
346
This will always be called once per attempt, except when a failure occurs
@@ -360,14 +365,14 @@ def read_before_transmit(
360
365
self , context : InterceptorContext [Request , None , TransportRequest , None ]
361
366
) -> None :
362
367
"""
363
- A hook called before the transport request message is sent to the service.
368
+ A hook called before the transport request is sent to the service.
364
369
365
370
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
366
371
or `transport_response` in this hook.
367
372
368
373
This will always be called once per attempt, except when a failure occurs
369
374
earlier in the request pipeline. This method may be called multiple times in
370
- the event of retries.The duration between invocation of this hook and
375
+ the event of retries. The duration between invocation of this hook and
371
376
`read_after_transmit` is very close to the amount of time spent communicating
372
377
with the service. Depending on the protocol, the duration may not include the
373
378
time spent reading the response data.
@@ -387,16 +392,16 @@ def read_after_transmit(
387
392
context : InterceptorContext [Request , None , TransportRequest , TransportResponse ],
388
393
) -> None :
389
394
"""
390
- A hook called after the transport request message is sent to the service and a
395
+ A hook called after the transport request is sent to the service and a
391
396
transport response is received.
392
397
393
398
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
394
399
or `transport_response` in this hook.
395
400
396
401
This will always be called once per attempt, except when a failure occurs
397
402
earlier in the request pipeline. This method may be called multiple times in
398
- the event of retries. The duration between invocation of this hook and
399
- `read_before_transmit` is very close to the amount of time spent communicating
403
+ the event of retries. The duration between `read_before_transmit` and the
404
+ invocation of this hook is very close to the amount of time spent communicating
400
405
with the service. Depending on the protocol, the duration may not include the
401
406
time spent reading the response data.
402
407
@@ -415,7 +420,7 @@ def modify_before_deserialization(
415
420
context : InterceptorContext [Request , None , TransportRequest , TransportResponse ],
416
421
) -> TransportResponse :
417
422
"""
418
- A hook called before the transport response is unmarshalled . This method has
423
+ A hook called before the transport response is deserialized . This method has
419
424
the ability to modify and return a new transport response of the same type.
420
425
421
426
This will always be called once per attempt, except when a failure occurs
@@ -444,7 +449,7 @@ def read_before_deserialization(
444
449
context : InterceptorContext [Request , None , TransportRequest , TransportResponse ],
445
450
) -> None :
446
451
"""
447
- A hook called before the transport response is unmarshalled .
452
+ A hook called before the transport response is deserialized .
448
453
449
454
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
450
455
or `transport_response` in this hook.
@@ -453,7 +458,7 @@ def read_before_deserialization(
453
458
earlier in the request pipeline. This method may be called multiple times in
454
459
the event of retries. The duration between invocation of this hook and
455
460
`read_after_deserialization` is very close to the amount of time spent
456
- unmarshalling the service response. Depending on the protocol and operation,
461
+ deserializing the service response. Depending on the protocol and operation,
457
462
the duration may include the time spent downloading the response data.
458
463
459
464
The `request`, `transport_request`, and `transport_response` of the context
@@ -473,16 +478,16 @@ def read_after_deserialization(
473
478
],
474
479
) -> None :
475
480
"""
476
- A hook called after the transport response is unmarshalled .
481
+ A hook called after the transport response is deserialized .
477
482
478
483
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
479
484
or `transport_response` in this hook.
480
485
481
486
This will always be called once per attempt, except when a failure occurs
482
487
earlier in the request pipeline. This method may be called multiple times in
483
- the event of retries. The duration between invocation of this hook and
484
- `read_before_deserialization` is very close to the amount of time spent
485
- unmarshalling the service response. Depending on the protocol and operation,
488
+ the event of retries. The duration between `read_before_deserialization`
489
+ and the invocation of this hook is very close to the amount of time spent
490
+ deserializing the service response. Depending on the protocol and operation,
486
491
the duration may include the time spent downloading the response data.
487
492
488
493
The `request`, `response`, `transport_request`, and `transport_response` of the
@@ -592,9 +597,9 @@ def read_after_execution(
592
597
Implementations MUST NOT modify the `request`, `response`, `transport_request`,
593
598
or `transport_response` in this hook.
594
599
595
- This will always be called once per execution. The duration between invocation
596
- of this hook and `read_before_execution` is very close to the full duration of
597
- the execution.
600
+ This will always be called once per execution. The duration between
601
+ `read_before_execution` and the invocation of this hook is very close to the
602
+ full duration of the execution.
598
603
599
604
The `request` and `response` of the context will always be available. The
600
605
`transport_request` and `transport_response` will be available if the execution
0 commit comments