| Server IP : 162.214.74.102 / Your IP : 216.73.216.192 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/alt/python38/lib/python3.8/site-packages/sentry_sdk/integrations/ |
Upload File : |
from sentry_sdk.hub import Hub
from sentry_sdk.integrations import Integration
try:
from httplib import HTTPConnection # type: ignore
except ImportError:
from http.client import HTTPConnection
class StdlibIntegration(Integration):
identifier = "stdlib"
@staticmethod
def setup_once():
# type: () -> None
install_httplib()
def install_httplib():
# type: () -> None
real_putrequest = HTTPConnection.putrequest
real_getresponse = HTTPConnection.getresponse
def putrequest(self, method, url, *args, **kwargs):
rv = real_putrequest(self, method, url, *args, **kwargs)
if Hub.current.get_integration(StdlibIntegration) is None:
return rv
self._sentrysdk_data_dict = data = {}
host = self.host
port = self.port
default_port = self.default_port
real_url = url
if not real_url.startswith(("http://", "https://")):
real_url = "%s://%s%s%s" % (
default_port == 443 and "https" or "http",
host,
port != default_port and ":%s" % port or "",
url,
)
data["url"] = real_url
data["method"] = method
return rv
def getresponse(self, *args, **kwargs):
rv = real_getresponse(self, *args, **kwargs)
hub = Hub.current
if hub.get_integration(StdlibIntegration) is None:
return rv
data = getattr(self, "_sentrysdk_data_dict", None) or {}
if "status_code" not in data:
data["status_code"] = rv.status
data["reason"] = rv.reason
hub.add_breadcrumb(
type="http", category="httplib", data=data, hint={"httplib_response": rv}
)
return rv
HTTPConnection.putrequest = putrequest
HTTPConnection.getresponse = getresponse