Skip to content

Commit 76e1cd2

Browse files
authored
Fixed requests patch issue
1 parent 17b033e commit 76e1cd2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

aws_xray_sdk/ext/requests/patch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77

88
def patch():
9-
109
wrapt.wrap_function_wrapper(
1110
'requests',
12-
'Session.request',
11+
'Session.send',
1312
_xray_traced_requests
1413
)
1514

@@ -22,7 +21,7 @@ def patch():
2221

2322
def _xray_traced_requests(wrapped, instance, args, kwargs):
2423

25-
url = kwargs.get('url') or args[1]
24+
url = args[0].url
2625

2726
return xray_recorder.record_subsegment(
2827
wrapped, instance, args, kwargs,
@@ -43,9 +42,10 @@ def _inject_header(wrapped, instance, args, kwargs):
4342

4443
def requests_processor(wrapped, instance, args, kwargs,
4544
return_value, exception, subsegment, stack):
46-
47-
method = kwargs.get('method') or args[0]
48-
url = kwargs.get('url') or args[1]
45+
46+
request = args[0]
47+
method = request.method
48+
url = request.url
4949

5050
subsegment.put_http_meta(http.METHOD, method)
5151
subsegment.put_http_meta(http.URL, strip_url(url))

0 commit comments

Comments
 (0)