@@ -163,7 +163,7 @@ def _parse_rate_limits(
163
163
164
164
165
165
class HttpTransportCore (Transport ):
166
- """The base HTTP transport ."""
166
+ """Shared base class for sync and async transports ."""
167
167
168
168
TIMEOUT = 30 # seconds
169
169
@@ -392,6 +392,8 @@ def is_healthy(self: Self) -> bool:
392
392
def _prepare_envelope (
393
393
self : Self , envelope : Envelope
394
394
) -> Optional [Tuple [Envelope , io .BytesIO , Dict [str , str ]]]:
395
+
396
+ # remove all items from the envelope which are over quota
395
397
new_items = []
396
398
for item in envelope .items :
397
399
if self ._check_disabled (item .data_category ):
@@ -500,18 +502,18 @@ def kill(self: Self) -> None:
500
502
501
503
502
504
class BaseHttpTransport (HttpTransportCore ):
505
+ """The base HTTP transport."""
503
506
504
507
def _send_envelope (self : Self , envelope : Envelope ) -> None :
505
508
_prepared_envelope = self ._prepare_envelope (envelope )
506
- if _prepared_envelope is None :
507
- return None
508
- envelope , body , headers = _prepared_envelope
509
- self ._send_request (
510
- body .getvalue (),
511
- headers = headers ,
512
- endpoint_type = EndpointType .ENVELOPE ,
513
- envelope = envelope ,
514
- )
509
+ if _prepared_envelope is not None :
510
+ envelope , body , headers = _prepared_envelope
511
+ self ._send_request (
512
+ body .getvalue (),
513
+ headers = headers ,
514
+ endpoint_type = EndpointType .ENVELOPE ,
515
+ envelope = envelope ,
516
+ )
515
517
return None
516
518
517
519
def _send_request (
0 commit comments