U \M@sfddlmZddlmZzddlmZWn ek rHddlmZYnXGdddeZddZ dS) )Hub) Integration)HTTPConnectionc@seZdZdZeddZdS)StdlibIntegrationZstdlibcCs tdS)N)install_httplibrr /stdlib.py setup_onceszStdlibIntegration.setup_onceN)__name__ __module__ __qualname__Z identifier staticmethodr rrrrr srcs4tjtjfdd}fdd}|t_|t_dS)Nc s|||f||}tjtdkr(|Si|_}|j}|j}|j} |} | ds~d| dkr`dpbd||| krtd|pvd|f} | |d<||d <|S) N)zhttp://zhttps://z %s://%s%s%siZhttpshttpz:%surlmethod) rcurrentget_integrationr_sentrysdk_data_dicthostport default_port startswith) selfrrargskwargsrvdatarrrZreal_url)real_putrequestrr putrequests$  z#install_httplib..putrequestcsn|f||}tj}|tdkr(|St|ddp6i}d|krT|j|d<|j|d<|jdd|d|id|S)NrZ status_codereasonrhttplibZhttplib_response)typecategoryrZhint)rrrrgetattrZstatusr Zadd_breadcrumb)rrrrZhubr)real_getresponserr getresponse1s  z$install_httplib..getresponse)rrr&)rr&r)r%rrrs   rN) Zsentry_sdk.hubrZsentry_sdk.integrationsrr!r ImportErrorZ http.clientrrrrrrs