$86 GRAYBYTE WORDPRESS FILE MANAGER $58

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/

HOME
Current File : /opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations//httpx.py
from sentry_sdk import Hub
from sentry_sdk.integrations import Integration, DidNotEnable

from sentry_sdk._types import MYPY

if MYPY:
    from typing import Any


try:
    from httpx import AsyncClient, Client, Request, Response  # type: ignore
except ImportError:
    raise DidNotEnable("httpx is not installed")

__all__ = ["HttpxIntegration"]


class HttpxIntegration(Integration):
    identifier = "httpx"

    @staticmethod
    def setup_once():
        # type: () -> None
        """
        httpx has its own transport layer and can be customized when needed,
        so patch Client.send and AsyncClient.send to support both synchronous and async interfaces.
        """
        _install_httpx_client()
        _install_httpx_async_client()


def _install_httpx_client():
    # type: () -> None
    real_send = Client.send

    def send(self, request, **kwargs):
        # type: (Client, Request, **Any) -> Response
        hub = Hub.current
        if hub.get_integration(HttpxIntegration) is None:
            return real_send(self, request, **kwargs)

        with hub.start_span(
            op="http", description="%s %s" % (request.method, request.url)
        ) as span:
            span.set_data("method", request.method)
            span.set_data("url", str(request.url))
            for key, value in hub.iter_trace_propagation_headers():
                request.headers[key] = value
            rv = real_send(self, request, **kwargs)

            span.set_data("status_code", rv.status_code)
            span.set_http_status(rv.status_code)
            span.set_data("reason", rv.reason_phrase)
            return rv

    Client.send = send


def _install_httpx_async_client():
    # type: () -> None
    real_send = AsyncClient.send

    async def send(self, request, **kwargs):
        # type: (AsyncClient, Request, **Any) -> Response
        hub = Hub.current
        if hub.get_integration(HttpxIntegration) is None:
            return await real_send(self, request, **kwargs)

        with hub.start_span(
            op="http", description="%s %s" % (request.method, request.url)
        ) as span:
            span.set_data("method", request.method)
            span.set_data("url", str(request.url))
            for key, value in hub.iter_trace_propagation_headers():
                request.headers[key] = value
            rv = await real_send(self, request, **kwargs)

            span.set_data("status_code", rv.status_code)
            span.set_http_status(rv.status_code)
            span.set_data("reason", rv.reason_phrase)
            return rv

    AsyncClient.send = send

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 6.48 AM
root / 996
0755
__pycache__
--
31 Aug 2024 6.48 AM
root / 996
0755
django
--
31 Aug 2024 6.48 AM
root / 996
0755
spark
--
31 Aug 2024 6.48 AM
root / 996
0755
__init__.py
6.356 KB
27 Jul 2021 9.04 PM
root / 996
0644
_wsgi_common.py
4.651 KB
27 Jul 2021 9.04 PM
root / 996
0644
aiohttp.py
7.766 KB
27 Jul 2021 9.04 PM
root / 996
0644
argv.py
0.923 KB
27 Jul 2021 9.04 PM
root / 996
0644
asgi.py
8.257 KB
27 Jul 2021 9.04 PM
root / 996
0644
atexit.py
1.794 KB
27 Jul 2021 9.04 PM
root / 996
0644
aws_lambda.py
14.987 KB
27 Jul 2021 9.04 PM
root / 996
0644
beam.py
5.529 KB
27 Jul 2021 9.04 PM
root / 996
0644
boto3.py
4.048 KB
27 Jul 2021 9.04 PM
root / 996
0644
bottle.py
6.062 KB
27 Jul 2021 9.04 PM
root / 996
0644
celery.py
9.312 KB
27 Jul 2021 9.04 PM
root / 996
0644
chalice.py
4.502 KB
27 Jul 2021 9.04 PM
root / 996
0644
dedupe.py
1.139 KB
27 Jul 2021 9.04 PM
root / 996
0644
excepthook.py
2.139 KB
27 Jul 2021 9.04 PM
root / 996
0644
executing.py
1.976 KB
27 Jul 2021 9.04 PM
root / 996
0644
falcon.py
6.637 KB
27 Jul 2021 9.04 PM
root / 996
0644
flask.py
7.296 KB
27 Jul 2021 9.04 PM
root / 996
0644
gcp.py
7.842 KB
27 Jul 2021 9.04 PM
root / 996
0644
gnu_backtrace.py
2.844 KB
27 Jul 2021 9.04 PM
root / 996
0644
httpx.py
2.552 KB
27 Jul 2021 9.04 PM
root / 996
0644
logging.py
7.543 KB
27 Jul 2021 9.04 PM
root / 996
0644
modules.py
1.36 KB
27 Jul 2021 9.04 PM
root / 996
0644
pure_eval.py
4.414 KB
27 Jul 2021 9.04 PM
root / 996
0644
pyramid.py
6.906 KB
27 Jul 2021 9.04 PM
root / 996
0644
redis.py
3.004 KB
27 Jul 2021 9.04 PM
root / 996
0644
rq.py
4.838 KB
27 Jul 2021 9.04 PM
root / 996
0644
sanic.py
8.444 KB
27 Jul 2021 9.04 PM
root / 996
0644
serverless.py
1.925 KB
27 Jul 2021 9.04 PM
root / 996
0644
sqlalchemy.py
2.87 KB
27 Jul 2021 9.04 PM
root / 996
0644
stdlib.py
7.245 KB
27 Jul 2021 9.04 PM
root / 996
0644
threading.py
2.789 KB
27 Jul 2021 9.04 PM
root / 996
0644
tornado.py
7.018 KB
27 Jul 2021 9.04 PM
root / 996
0644
trytond.py
1.688 KB
27 Jul 2021 9.04 PM
root / 996
0644
wsgi.py
10.888 KB
27 Jul 2021 9.04 PM
root / 996
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF