Skip to content

Commit 10f96a7

Browse files
committed
trying something with httpx
1 parent 5b9da4b commit 10f96a7

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
jinja2
22
packaging
33
requests
4+
sentry_sdk

tests/integrations/httpx/test_httpx.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
from tests.conftest import ApproxDict
1313

1414

15+
timeout = httpx.Timeout(10.0, read_timeout=None)
16+
17+
1518
@pytest.mark.parametrize(
1619
"httpx_client",
1720
(httpx.Client(), httpx.AsyncClient()),
@@ -31,7 +34,7 @@ def before_breadcrumb(crumb, hint):
3134

3235
if asyncio.iscoroutinefunction(httpx_client.get):
3336
response = asyncio.get_event_loop().run_until_complete(
34-
httpx_client.get(url)
37+
httpx_client.get(url, timeout=timeout, verify=False)
3538
)
3639
else:
3740
response = httpx_client.get(url)
@@ -74,7 +77,7 @@ def test_outgoing_trace_headers(sentry_init, httpx_client):
7477
) as transaction:
7578
if asyncio.iscoroutinefunction(httpx_client.get):
7679
response = asyncio.get_event_loop().run_until_complete(
77-
httpx_client.get(url)
80+
httpx_client.get(url, timeout=timeout, verify=False)
7881
)
7982
else:
8083
response = httpx_client.get(url)
@@ -110,7 +113,12 @@ def test_outgoing_trace_headers_append_to_baggage(sentry_init, httpx_client):
110113
) as transaction:
111114
if asyncio.iscoroutinefunction(httpx_client.get):
112115
response = asyncio.get_event_loop().run_until_complete(
113-
httpx_client.get(url, headers={"baGGage": "custom=data"})
116+
httpx_client.get(
117+
url,
118+
headers={"baGGage": "custom=data"},
119+
timeout=timeout,
120+
verify=False,
121+
)
114122
)
115123
else:
116124
response = httpx_client.get(url, headers={"baGGage": "custom=data"})
@@ -261,7 +269,9 @@ def test_option_trace_propagation_targets(
261269

262270
with sentry_sdk.start_transaction(): # Must be in a transaction to propagate headers
263271
if asyncio.iscoroutinefunction(httpx_client.get):
264-
asyncio.get_event_loop().run_until_complete(httpx_client.get(url))
272+
asyncio.get_event_loop().run_until_complete(
273+
httpx_client.get(url, timeout=timeout, verify=False)
274+
)
265275
else:
266276
httpx_client.get(url)
267277

@@ -339,7 +349,9 @@ def test_span_origin(sentry_init, capture_events, httpx_client):
339349

340350
with start_transaction(name="test_transaction"):
341351
if asyncio.iscoroutinefunction(httpx_client.get):
342-
asyncio.get_event_loop().run_until_complete(httpx_client.get(url))
352+
asyncio.get_event_loop().run_until_complete(
353+
httpx_client.get(url, timeout=timeout, verify=False)
354+
)
343355
else:
344356
httpx_client.get(url)
345357

0 commit comments

Comments
 (0)