Choose Sentry Python's Proxy Route at init
Set sentry-sdk's explicit proxy options, or clear both when deliberately disabling environment-derived routing.
import sentry_sdk
sentry_sdk.init(
dsn=sentry_dsn,
http_proxy='http://proxy.example:8080',
https_proxy='http://proxy.example:8080',
)Keep sentry_dsn as the Sentry project destination. These sentry-sdk options select the intermediary for the built-in HTTP transport.
| Desired policy | Configuration consequence |
|---|---|
| Use an explicit proxy | Supply the proxy options at initialization, as shown; the HTTP proxy list can supply candidates for a public HTTP route. |
| Use environment settings | Omit explicit values. For an HTTPS DSN, the transport tries the HTTPS proxy path first and can fall back to HTTP. |
| Disable environment-derived paths | Set both explicit proxy options to empty strings. Clearing only HTTPS can leave HTTP fallback. |
Raven's ThreadedRequestsHTTPTransport belongs to the older raven-python package; it is not this initialization interface.
Then evaluate delivery at the transport stage. The standard HTTP transport normally queues work on a background worker, so successful initialization or an event identifier does not show the envelope reached the proxy. Use the supported flush or shutdown lifecycle in a short-lived application, retaining transport errors without exposing secrets.