---
title: "pyreqwest"
description: "Learn about the pyreqwest integration and how it adds support for the pyreqwest HTTP client."
url: https://docs.sentry.io/platforms/python/integrations/pyreqwest/
---

# pyreqwest | Sentry for Python

The [pyreqwest](https://markussintonen.github.io/pyreqwest/pyreqwest.html) integration instruments outgoing HTTP requests using either the sync or the async pyreqwest client.

Use this integration to create spans for outgoing requests and ensure traces are properly propagated to downstream services.

## [Install](https://docs.sentry.io/platforms/python/integrations/pyreqwest.md#install)

Install `sentry-sdk` from PyPI:

```bash
pip install sentry-sdk
```

## [Configure](https://docs.sentry.io/platforms/python/integrations/pyreqwest.md#configure)

To enable the pyreqwest integration, add `PyreqwestIntegration` to your `integrations`:

```python
import sentry_sdk
from sentry_sdk.integrations.pyreqwest import PyreqwestIntegration

sentry_sdk.init(
    dsn="___PUBLIC_DSN___",
    # Add data like request headers and IP for users, if applicable;
    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
    send_default_pii=True,
    integrations=[
        PyreqwestIntegration(),
    ],
)
```

## [Verify](https://docs.sentry.io/platforms/python/integrations/pyreqwest.md#verify)

```python
import asyncio

from pyreqwest.client import ClientBuilder, SyncClientBuilder

sentry_sdk.init(...)  # same as above

async def example_async():
    async with ClientBuilder().error_for_status(True).build() as client:
        response = await client.get("http://example.com").build().send()

def example_sync():
    with SyncClientBuilder().error_for_status(True).build() as client:
        response = client.get("http://example.com").build().send()


with sentry_sdk.start_transaction(name="pyreqwest async"):
    asyncio.run(example_async())

with sentry_sdk.start_transaction(name="pyreqwest sync"):
    example_sync()
```

This will create two transactions, `pyreqwest async` and `pyreqwest sync`, in the Traces section of [sentry.io](https://sentry.io), and create spans for the outgoing HTTP requests.

It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io).

## [Supported Versions](https://docs.sentry.io/platforms/python/integrations/pyreqwest.md#supported-versions)

* pyreqwest: 0.11.6+
* Python: 3.11+
