55import socket
66import ssl
77import time
8- import warnings
98from datetime import datetime , timedelta , timezone
109from collections import defaultdict
1110from urllib .request import getproxies
4039 from urllib3 .poolmanager import PoolManager
4140 from urllib3 .poolmanager import ProxyManager
4241
43- from sentry_sdk ._types import Event , EventDataCategory
42+ from sentry_sdk ._types import EventDataCategory
4443
4544KEEP_ALIVE_SOCKET_OPTIONS = []
4645for option in [
@@ -73,25 +72,6 @@ def __init__(self, options=None):
7372 else :
7473 self .parsed_dsn = None
7574
76- def capture_event (self , event ):
77- # type: (Self, Event) -> None
78- """
79- DEPRECATED: Please use capture_envelope instead.
80-
81- This gets invoked with the event dictionary when an event should
82- be sent to sentry.
83- """
84-
85- warnings .warn (
86- "capture_event is deprecated, please use capture_envelope instead!" ,
87- DeprecationWarning ,
88- stacklevel = 2 ,
89- )
90-
91- envelope = Envelope ()
92- envelope .add_event (event )
93- self .capture_envelope (envelope )
94-
9575 @abstractmethod
9676 def capture_envelope (self , envelope ):
9777 # type: (Self, Envelope) -> None
@@ -806,35 +786,6 @@ def _make_pool(self):
806786 return httpcore .ConnectionPool (** opts )
807787
808788
809- class _FunctionTransport (Transport ):
810- """
811- DEPRECATED: Users wishing to provide a custom transport should subclass
812- the Transport class, rather than providing a function.
813- """
814-
815- def __init__ (
816- self , func # type: Callable[[Event], None]
817- ):
818- # type: (...) -> None
819- Transport .__init__ (self )
820- self ._func = func
821-
822- def capture_event (
823- self , event # type: Event
824- ):
825- # type: (...) -> None
826- self ._func (event )
827- return None
828-
829- def capture_envelope (self , envelope : Envelope ) -> None :
830- # Since function transports expect to be called with an event, we need
831- # to iterate over the envelope and call the function for each event, via
832- # the deprecated capture_event method.
833- event = envelope .get_event ()
834- if event is not None :
835- self .capture_event (event )
836-
837-
838789def make_transport (options ):
839790 # type: (Dict[str, Any]) -> Optional[Transport]
840791 ref_transport = options ["transport" ]
@@ -850,14 +801,6 @@ def make_transport(options):
850801 return ref_transport
851802 elif isinstance (ref_transport , type ) and issubclass (ref_transport , Transport ):
852803 transport_cls = ref_transport
853- elif callable (ref_transport ):
854- warnings .warn (
855- "Function transports are deprecated and will be removed in a future release."
856- "Please provide a Transport instance or subclass, instead." ,
857- DeprecationWarning ,
858- stacklevel = 2 ,
859- )
860- return _FunctionTransport (ref_transport )
861804
862805 # if a transport class is given only instantiate it if the dsn is not
863806 # empty or None
0 commit comments