Skip to content

Commit 1c91c9e

Browse files
authored
Merge pull request #1 from Minitour/master
Fixed requests patch issue
2 parents 25c79a2 + 8b67e1d commit 1c91c9e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

aws_xray_sdk/ext/requests/patch.py

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

77

88
def patch():
9-
109
wrapt.wrap_function_wrapper(
1110
'requests',
1211
'Session.send',
@@ -22,7 +21,7 @@ def patch():
2221

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

25-
url = args[1].url
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)